Feb 7, 2006 #1 omoo Programmer Joined May 30, 2005 Messages 87 Location US Hi, I need to create a file with the same filename as another file in another directory but without the contents. For example, I have: originaldirectory/oldfile.zip size:1234kb I need to create: newdirectory/oldfile.zip size:no contents - 0kb
Hi, I need to create a file with the same filename as another file in another directory but without the contents. For example, I have: originaldirectory/oldfile.zip size:1234kb I need to create: newdirectory/oldfile.zip size:no contents - 0kb
Feb 7, 2006 #2 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Code: cd originaldirectory for f in *; do touch "newdirectory/$f"; done Or if you want to skip subdirectories : Code: cd originaldirectory for f in *; do test ! -d "$f" && touch "newdirectory/$f"; done Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Code: cd originaldirectory for f in *; do touch "newdirectory/$f"; done Or if you want to skip subdirectories : Code: cd originaldirectory for f in *; do test ! -d "$f" && touch "newdirectory/$f"; done Feherke. http://rootshell.be/~feherke/
Feb 7, 2006 #3 columb IS-IT--Management Joined Feb 5, 2004 Messages 1,231 Location EU Use Code: > newdirectory/oldfile.zip For example Code: for file in $(ls olddirectory) do > newdirectory/$file done this will produce a zeor length file in newdirectory for every file in olddirectory. You can also use touch i.e. Code: for file in $(ls olddirectory) do touch newdirectory/$file done will do the same thing Columb Healy Upvote 0 Downvote
Use Code: > newdirectory/oldfile.zip For example Code: for file in $(ls olddirectory) do > newdirectory/$file done this will produce a zeor length file in newdirectory for every file in olddirectory. You can also use touch i.e. Code: for file in $(ls olddirectory) do touch newdirectory/$file done will do the same thing Columb Healy