@Hari Of course, but I need a bit more detail around how you want to name the directories you mentioned.
As a starting point, you could so something like this
You can use the find command along with bash to achieve this. Here’s an example command:
find /path/to/root/directory -type f -name "*.mp4" -exec bash -c 'for file; do mv "$file" "$(date +"%Y%m%d")-${file##*/}"; done' bash {} +
This command will find all .mp4 files under the specified root directory and its subdirectories, then rename them to the format date-filename1.mp4
, where the date is in the format YYYYMMDD
.
Here’s a breakdown of what will happen
find /path/to/root/directory -type f -name "*.mp4"
- Finds all files with the extension .mp4 under the specified root directory.
-exec bash -c '...' bash {} +
- Executes the specified bash command for each found file.
'for file; do mv "$file" "$(date +"%Y%m%d")-${file##*/}"; done'
This bash script renames each file by appending the date and a hyphen to the original filename.
Make sure to replace /path/to/root/directory
with the actual path to your root directory.