Reputation: 511
I want to create a clone of the structure of one big folder (500Gb). I can do this easily with the below command :
cd /path/to/directories && find . -type d -exec mkdir -p -- /path/to/backup/{} \;
Now I also want to clone files (I mean copy each file but empty files)
For example let's suggest /path/to/directories/file.txt takes 1Gb space. I want /path/to/backup/file.txt to be empty (1Kb)
Maybe I can use this command
> filename
Any idea ?
Upvotes: 0
Views: 209
Reputation: 1407
Try this:
cd /path/to/dirs ; find | while read f ; do [ ! -d "$f" ] && touch "/path/to/backup/$f" || mkdir -p "/path/to/backup/$f" ; done
Regards
Upvotes: 1