• Linux
  • January 2018
    M T W T F S S
    « Dec   Feb »
  • Meta

  • Follow me on Twitter

  • Advertisements

cpmvpic script

Last April I created cpmvpic.sh (copy move picture), a bash script that copies files from a temporary folder to my Dropbox so I can access them on my other systems. It also moves the file out of the temporary folder into a particular folder on my main system. At the time I used the images in html documents so later I added functionality to copy the document containing the image to my Dropbox. Then several months later I began creating the documents in LibreOffice (odt) format so I disabled that feature.

Today I made some changes to the directory structure for the Dropbox copies of the files so I modified the script to reflect those changes. I also renamed some of the variables to give them more meaningful names and re-enabled the copying of the target document.

The script uses the name of the image file, the 2-digit month, and the 4-digit year to build the necessary paths and document file names from base path names. It checks for the correct number of arguments and the validity of the paths and file names. If an error is detected, it displays an appropriate error message and the correct syntax, then exits.

I use this script for a specific series of documents which use the same naming convention in a particular set of folders. Although it’s a specialized script, it could be easily adapted for similar file copy operations.

%d bloggers like this: