on-internet
← Community

shell script to move 2 files from one dir to another and rename it

Stack Overflow ·

I want to move 2 files from current directory to archive directory and rename the files while doing it with prefixing the date and changing the file extension. the script below it does work if i remove the move directory part of it. please see script and error message blow. the permission on the archive directory is 777 so is the files. #!/bin/bash cdate=$(date +%Y-%m-%d) destdir=${/home/dcaceres/load/archive} for file in allcustomer.csv loadcustomer.csv; do mv "$file" "$destdir/$cdate"_"$file"".ARCHIVE" done The error: ./archive_customer_load.sh: line 3: /home/dcaceres/load/archive: Is a dire

Comments

Sign in or sign up to comment and upvote.

No comments yet.