Move Files Recursively From Specific Date

thunderclap

New Member
Joined
Oct 11, 2022
Messages
5
Reaction score
0
Credits
52
At our office, we use ResourceSpace as our digital asset manager. Over the weekend we suffered a hardware failure that resulted in having to reinstall Ubuntu. While all the files are there, the database was corrupted in its backup and we had to pull one from several months ago. We've found the files that have been uploaded since that date (May 10) but are no longer referenced in the database and backed them up via Windows, however they didn't retain the directory structure.

We're looking for a way to copy/move/rsync the directory and files recursively from May 10 forward for backup, and then delete only those files from May 10 forward as they are taking up 230GB and are not accessible by ResourceSpace as they aren't referenced in the database.

Any help is appreciated. Thanks.
 


I don't have a clue, but you can ask them if you're paying for the product. Support comes along with your contract. So, if nobody here knows, you can try them - if you're a paying customer.
 
I don't have a clue, but you can ask them if you're paying for the product. Support comes along with your contract. So, if nobody here knows, you can try them - if you're a paying customer.
We're not. We installed the open-source software and it's housed internally.
 
We're not. We installed the open-source software and it's housed internally.

Maybe someone here will know and help you out. Be patient and hopefully someone'll come along that knows what they're doing. I checked the site and all they seem to offer is help documentation (which I'm sure you've already checked). They don't seem to have a forum for community support, which is unfortunate.
 
Maybe someone here will know and help you out. Be patient and hopefully someone'll come along that knows what they're doing. I checked the site and all they seem to offer is help documentation (which I'm sure you've already checked). They don't seem to have a forum for community support, which is unfortunate.
Thank you for that. I'll be patient and see if someone here can assist.

As for ResourceSpace, they actually do have a support forum in Google Groups, it's just not very good. And my question has more to do with Linux than ResourceSpace as I just need to move and/or copy and then delete directories and files recursively within a specific date range.
 
thunderclap wrote:
We've found the files
....
We're looking for a way to copy/move/rsync the directory and files recursively from May 10 forward for backup,
I'm not entirely clear on the situation you are in, but it seems that you have found the files to be moved which are in a directory structure which you wish to move retaining that structure. The tool that comes to mind is: tar. tar will pack up the files into a single archive file and maintain the directory structure which can then be moved to another location and extracted there. After checking that everything is in order, then the originals can be deleted in the normal manner with with rm.
 
The best way would probably be to use find and tar in order to archive the files in a .tar.gz.
e.g.
Bash:
find /path/to/search -type f -newermt 20220530 -print0 | tar -czf /path/to/backupDir/backup.tar.gz --null -T -

That should create a .tar.gz archive of all files since May 30th 2022, preserving the directory structure.

Obviously replace /path/to/search with the search path. And replace /path/to/backupDir/backup.tar.gz with the path/filename for the backup file.

Also, EXTREMELY IMPORTANT - make sure that the backup .tar.gz file is stored somewhere safely away from the search directory. Because now we've backed up the files, the next task is to remove them.
To do that, it's probably quicker and easier to run find again and use the -delete option to delete the files.

But if you've stored the backup file inside the search-path, then the next command I'm about to post will remove the backup file AND the other files. So to avoid this, ensure that the directory containing the backup is NOT inside the search path for the other files. Probably best to make sure the backup file is saved to another mounted drive/device.

To remove all of the files we just backed up:
Bash:
find /path/to/search -type f -newermt 20220530 -delete
You did remember to save your backup file outside the search directory didn't you?! (see the EXTREMELY IMPORTANT note above).
If you did - then your backup is safe and all of the files added since May 30th 2022 have been removed.
If NOT, your backup AND your files are gone - in which case you should have read the EXTREMELY IMPORTANT note above!

I hope this helps!
 


Latest posts

Top