PDA

View Full Version : Need help with a simple unix command



CitznFish
12-16-2002, 08:07 PM
I have been trying to use the 'touch' command to update the creation dates for graphics on our system that begin with 0103 (for example 0103_wreath.gif). The server contains Multiple sub directories and 1000's of images. I have tried using the following:

----------------------------------------------------------------------------------
find /pool/Content/Family/PublicAssets/Resources/1013* | xargs touch

This didnt work at all
----------------------------------------------------------------------------------






------------------------------------------------------------------------------------
find /pool/Content/Family/PublicAssets/Resources/* | xargs touch 0103*

This touched ALL files..
--------------------------------------------------------------------------




can someone show me the correct syntax? Thank you.

Catman
12-16-2002, 10:06 PM
Try touch ./0103* -- that should keep touch from misreading the numbers as the time argument.

CitznFish
12-18-2002, 08:35 PM
I think I am doing something wrong..I tried your suggestion but got these results. I haven't been able to figure this out reading any documentation online...

[ddumond@bugsy-new] cd //
[ddumond@bugsy-new] cd /pool/Content/Family/PublicAssets/Resources
[ddumond@bugsy-new] cd ..
[ddumond@bugsy-new] find Resources | xargs touch ./0103*
touch: contest/.HSResource: Not a directory
touch: contest/large: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/AmandaThompson_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/.HSancillary: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/LawrenceBroadnax_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/DakotaSibble_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/JoeySend_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/JoshuaLacoma_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/JoshuaLacomalg.gif: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/MitchellOliver_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/LoganLazama_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/MatthewMills_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/NatalieKirner_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/NatalieKirner.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/funnystuffweb_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/SaraTyree_lg.jpg: Not a directory
touch: contest/large: Not a directory
touch: baby.gifs/semifinalist.gif: Not a directory
touch: contest/semifinalistspon.gif: Not a directory
touch: contest/.HSancillary: Not a directory
touch: gifs/.HSancillary: Not a directory
touch: gifs/care_ess.gif: Not a directory
touch: gifs/more.gif: Not a directory
xargs: unmatched single quote
Broken Pipe

Catman
12-19-2002, 02:20 PM
Apparently piping won't work in this case.

Two ideas: 1. Create a script which traverses the subdirectories and runs the touch command in each directory; 2. Write a simple C program which uses utime and directory commands.

fivesidecube
12-30-2002, 01:24 PM
Try:
find /pool/Content/Family/PublicAssets/Resources/1013 -type f -exec touch {} \;

In non-unix speak: find all directory items in the /pool/Content/Family/PublicAssets/Resources/1013 folder where the type of the item is a standard file. Any matching item execute the command 'touch <item path and name>'

If you need a file name pattern add the '-name *.txt' before the -exec in the above.

Hope this helps.