Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Southern California
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need help with a simple unix command

    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.
    Everyone has the right to be stupid, some just abuse the privilege.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ames, IA, USA
    Posts
    373
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try touch ./0103* -- that should keep touch from misreading the numbers as the time argument.
    Need more emoticons?
    Visit Catman's Private Stock

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Location
    Southern California
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Everyone has the right to be stupid, some just abuse the privilege.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ames, IA, USA
    Posts
    373
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Need more emoticons?
    Visit Catman's Private Stock

  • #5
    New Coder
    Join Date
    Sep 2002
    Location
    Up North (UK)
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try:
    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •