0

I've got a directory which contains hundreds of thousands of files. A file typically looks like this : CED375_description_01.jpg. I need to move this file to another directory, but the file needs to be moved into the structure /ced/ced375/ced375_description_01.jpg.

What options do I have to achieve this?

0

1 Answer 1

3

I am not aware of an application that will do this for you. Your most likely solution is to write a script yourself, it shouldn't really be that difficult.


It appears that the source directory is in fact an NFS mount (we don't know what the destination directory is). This means that inotify can't be used.

The internet suggests that FAM may be of use in this scenario.

6
  • The primary challenge is that the number of files in the source directory will reach 1 million soon, and traversing all files (with a simple script) to compare the source and target directory each and every time seems like a less than optimal approach.
    – sbrattla
    Feb 9, 2015 at 11:44
  • Actually, the less than optimal approach was to put all the files in a single directory to start with. There are though utilities based upon incron that can monitor a directory and run commands when files are created/changed etc.
    – user9517
    Feb 9, 2015 at 11:55
  • Yes it is. If all files are in a single directory Linux offers for instance inotify to watch that directory for you, but changing the application that generates the filenames so a timestamp is included would already be a much better solution.
    – HBruijn
    Feb 9, 2015 at 11:58
  • Yes, I meant inotify not incron.
    – user9517
    Feb 9, 2015 at 12:11
  • 1
    That kind of information should have been provided in your question rather thay as an aside i a comment. That makes it very much harder. The internet suggests FAM
    – user9517
    Feb 9, 2015 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .