You can use Linux mv command with -f or –force option to overwrite a file. The destination file must exist or mv command will rename the source file.
1 2 3 4 5 6 7 8 9 10 11 |
mkdir mydir ## create some files and directory echo "one" > myfile echo "two" > mydir/myfile chmod 444 mydir/myfile ## make the file readonly mv myfile mydir/myfile ## mv: try to overwrite ‘mydir/myfile’, overriding mode 0444 (r--r--r--)? n mv -f myfile mydir/myfile ## no prompt this time rm -rf my* |