Answer the question
In order to leave comments, you need to log in
How to automate file copying with renaming in linux?
There is a source of files with a structure like yyyy\mm\Statistics for yyyymmdd.xls
Files in the source are added every working day. It is necessary to copy all xls files containing the words " Statistics for ", but so that the target file does not have it, that is:
Statistics for 20190318.xls -> 20190318.xls
Is it possible to do this with standard tools or maybe there are some third-party utilities suitable for this task?
Answer the question
In order to leave comments, you need to log in
Here is an example how to copy files from "Statistics for 20190318.xls" format to "20190318.xls"
then tune to your needs, for example, to rename cp, replace it with mv
find -name "*.xls" -exec sh -c 'mv "$1" `echo $1 | grep -o -E "[0-9]+"`.xls' sh {} \;
You can either use standard tools or write a script in any language available in the system.
Related https://unix.stackexchange.com/questions/227662/ho...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question