Zudnic Posted September 18, 2020 Share Posted September 18, 2020 Hi, I have a bunch of videos that I want to upload to Google Photos. They need to have their extensions changed, but I want to preserve the date/time of the files so they are indexed properly. Is there a single command that I can run that will: Recursively go through a directory and subdirectories and rename any file ending in '.foo' with '.bar' Do NOT update the file date/time I've done some research on this online and it appears there are several approaches to do one or the other, but I cannot determine the best way to combine the two. I am also a little gun-shy as a n00b and I really only have one shot at this, if I screw up the dates/times they're not recoverable. Thanks in advance! Quote Link to comment
trurl Posted September 18, 2020 Share Posted September 18, 2020 Since this is your first post here and you don't mention it, are you talking about doing this on Unraid? Quote Link to comment
Zudnic Posted September 18, 2020 Author Share Posted September 18, 2020 Yes I am... I figured I'd start here although this is more of a generic FreeBSD question. Quote Link to comment
civic95man Posted September 18, 2020 Share Posted September 18, 2020 You would probably need to 'copy' the source file to the destination using the --preserve=all option followed by deleting the source file (move [mv] doesn't allow to preserve timestamps). i.e. cp --preserve=all [source] [destination] rm [source] I'm not big on making scripts so perhaps someone else can help with that, or you can attempt it yourself. Might want to not remove anything until you are sure it works, or create a dummy directory and files to test on. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.