![]() ![]() ![]() Moving files could be done with rename as well, but as you didn’t give any specifics it’s hard to show that. This will just show the changes for a start, run the line without -n to actually perform the renaming. With rename ( sudo apt install rename) this is a single line operation: rename -n 's/.+(_.+)_0*(.+)\./\2\1./' F_S1_*.mp4 Make the script executable chmod a+x renamer.bashīecause of the way I've set the variables DIRECTORY_IN DIRECTORY_OUT and EXTENSION you can pass those as variables to customize the script e.g./renamer.bash input_directory output_directory mkv You can customize the values of "dir1" and "dir2" in the script to your input and output directories. # Remove leading zeros from the last element # Split the components of the name by underscores (_) NAME_IN="$(basename "$FILENAME" ".$EXTENSION")" # Find the base filename, excluding extension ![]() Here's an example of a bash script that should be capable.Ĭreate a file "renamer.bash" with the following content #!/usr/bin/env bashįor FILENAME in "$DIRECTORY_IN"/*."$EXTENSION" do ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |