I have a directory which contains data for several years and several months. Filenames have the format yy/mm/dd, f.e. 20150415, 20170831, 20121205 How can I find all data with month = 3? F.e. 20150302, 20160331, 20190315 Thanks for your help! Answer A question mark is a wildcard which stands for one character, so as your format seems to be YYYYmmDD,
Tag: filenames
Renaming long file names in bulk
I have file names like: I want something like: Are there good ways to rename these files in linux? Answer You could try using a loop to extract the important part of the filename: This will simply give you a new list of filenames. You can then move them: To break this down a little: loop over the *.gz files
How to delete numbers, dashes and underscores in the beginning of a file name
I have thousands of mp3 files but all with unusual file names such as 1-2songone.mp3, 2songtwo.mp3, 2_2_3_songthree.mp3. I want to remove all the numbers, dashes and underscores in the beginning of these files and get the result: Answer This can be done using extended globbing: This uses parameter expansion: ${fname##pattern} removes the longest possible match from the beginning of fname.
Linux – add creation Date or DateTime in the name of the file
I have a file on a Linux server which is created automatically. I would like to create a script which will automatically rename the file after it is created on the server, so it will add date or datetime information For example: Thank you! Answer Try this: Here is the manpage of date where you can find the different output