Rename scottrade statements

From raju

Task

Statements downloaded from Scottrade brokerage account are of the form Monthly_Statement_<abbreviated month name>_<year>_<account number>.pdf .

The idea here is to rename them as Monthly_Statement_<YYYY>_<MM>_<account_number>.pdf .

For example, Monthly_Statement_Jul_2014_12345678.pdf will be changed to Monthly_Statement_2014_07_12345678.pdf

Solution

Use the python script scottrade.py

For example, consider the following situation

 % ls -1 .
 [Content_Types].xml
 DownloadStatements_20151011233051.zip
 Monthly_Statement_Jul_2014_12345678.pdf

Run the script in dry mode. This will show the changes, but does not actually do renaming.

 % scottrade.py . --dry
 Trial run. No changes are made
 ./Monthly_Statement_Jul_2014_12345678.pdf  ->  ./Monthly_Statement_2014_07_12345678.pdf

Verify that file names have not changed.

 % ls -1 .
 [Content_Types].xml
 DownloadStatements_20151011233051.zip
 Monthly_Statement_Jul_2014_12345678.pdf

Rename the files

% scottrade.py .
 ./Monthly_Statement_Jul_2014_12345678.pdf  ->  ./Monthly_Statement_2014_07_12345678.pdf

Check the new file names

% ls -1 .
 [Content_Types].xml
 DownloadStatements_20151011233051.zip
 Monthly_Statement_2014_07_12345678.pdf

Note that only Monthly_Statement files are renamed. Other files are left as is.