Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
signoredellarete committed Jun 5, 2023
1 parent 9e0ae07 commit fcf60ec
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bck/
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# rename-arw
**rename-arw** is a script that operates in the folder in which it is launched and ranames all the RAW files with `.ARW` extension following this path: `YYYYMMDDHHmmss-<pattern><filename>`

## Description
**rename-arw** is a script that operates in the folder in which it is launched and ranames all the RAW files with `.ARW` extension following this path:

`YYYYMMDDHHmmss-<pattern><filename>`

> `<pattern>` must be provided by user.
> `YYYYMMDDHHmmss` is retrieved from the datetime metadata of the file.
## Installation
```
sudo mkdir -p /usr/local/bin/
sudo chmod +x /usr/local/bin/
cp rename-arw /usr/local/bin/
echo 'PATH=$PATH:/usr/local/bin/' >> ~/.bashrc
```

## Usage
```
cd <directory-containing-arw>
rename-arw <pattern>
```
37 changes: 37 additions & 0 deletions rename-fab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Check pattern argument

usage(){
echo " "
echo "Usage:"
echo "cd <directory-containing-arw>"
echo "rename-arw <pattern>"
echo " "
}

if [ -z "$1" ];then
echo "Error!"
echo "Argument <pattern> is missing."
usage
exit 1
else
pattern=${1}
fi

# Check
if arw_num=`ls -1|grep ARW|wc -l`; then
if [ ${arw_num} -lt 1 ];then
echo "Error!"
echo "No .ARW file found in this folder: $PWD"
usage
exit 1
fi
fi

# Execution
for i in `ls -1 *ARW`
do
datetime=`file -p ${i}|cut -d "," -f 13|cut -d "=" -f 2|tr ":" " "|tr -d " "`
echo ${i} "--->" ${datetime}-${pattern}${i}
mv ${i} ${datetime}-${pattern}${i}
done

0 comments on commit fcf60ec

Please sign in to comment.