Need to copy a large amount of files from one directory to another
find $directory1 -maxdepth 1 -type f -name '*' -exec mv {} $directory2/. \;
This can also be used with the mv command.
What to rename a number of file in a directory and preserve their numbering
rename "s/scenario/testcase-/" scenario*.xml
Files were
scenario2797.xml scenario4597.xml scenario6397.xml scenario8197.xml scenario9998.xml scenario2798.xml scenario4598.xml scenario6398.xml scenario8198.xml scenario9999.xml
Now they are
testcase-2797.xml testcase-4597.xml testcase-6397.xml testcase-8197.xml testcase-9998.xml testcase-2798.xml testcase-4598.xml testcase-6398.xml testcase-8198.xml testcase-9999.xml
for file in `find . -name '*.sql' -print 2>/dev/null` do echo $file echo "Dirname:" echo ${file##*/} filename=${file##*/} fileprefix=${filename%.*} dirname $file echo "fileprefix: $fileprefix" psql -d-U -f $filename > "results/$fileprefix.result" done
No comments:
Post a Comment