Fred'ô / JOPLIN : Script to rename tacitpart file

Created Sat, 23 Nov 2019 00:00:00 +0000 Modified Sat, 23 Nov 2019 00:00:00 +0000
71 Words

My script to rename tacitpart file :

#!/bin/bash
  
# ARIAS Frederic
#
# For MAC OS do
#

suffix=".tacitpart"
path="WebDAV"

for file in $path/*.tacitpart
do
    if [[ -f $file ]]; then
	filenew=$(basename $file $suffix)
        echo $file" -> "$filenew 
	mv $file $path/$filenew
	touch $path/$filenew
    fi
done

# 
for file in $path/.resource/*.tacitpart
do
    if [[ -f $file ]]; then
	$filenew = ${file/%$suffix}
        echo $file." -> ".$filenew
        mv $file $path/.resource/$filenew
        touch $path/.resource/$filenew
    fi
done