Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Archive files by date - year

    Any suggestion about how can I move files by year to a specific folder. the chalenge is that the original folder has millions of files, so I cannot list the files.




  2. #2
    Join Date
    Oct 2011
    Location
    Dublin, PA
    Posts
    381
    Thanks
    33
    Thanked 18 Times in 16 Posts
    Rep Power
    10
    Sure - this is probably a round-about way, but it should work.. touch two files for each year.. we'll use 2011.. compare files in the dir to those files.. move the ones that match..


    mkdir /path/to/2011
    touch --date "2011-01-01" /tmp/start
    touch --date "2012-01-01" /tmp/end
    for f in `find /path/to/millionfiles/ -type f -newer /tmp/start -not -newer /tmp/end`; do mv $f /path/to/2011/;done


    It may end up taking up all of the server resources.. so be ready to kill it

  3. #3
    Join Date
    Mar 2012
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    I think that some coding will enable you to archive certain files by date and year. On Windows, it's obviously a lot easier due to the fact that you can simply select the way you would like for the files to be organized. Hope the issue had been solved, though.

 

 

Similar Threads

  1. Rebuild of the Debian archive with clang
    By News in forum Linux News
    Replies: 0
    Last Post: 03-02-2012, 05:26 PM
  2. Replies: 0
    Last Post: 02-26-2012, 10:37 AM
  3. Replies: 0
    Last Post: 02-03-2012, 06:28 PM
  4. Replies: 0
    Last Post: 11-29-2011, 04:40 AM

Bookmarks

Posting Permissions

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








Check out Linux Central for Linux software and other goodies!





» Stats

Members: 3,591
Threads: 3,921
Posts: 9,452
Top Poster: Fred (1,486)
Welcome to our newest member, ancientgeek

» Links



Powered by vBadvanced CMPS