I am a reporter who works with data sets. Every time I get a new data set, I do two things at once: duplicate the file and lock the originals.
I want to automate this process. By changing the shell of the script, I use to create subfolders for creating project reports and imposing it along with a set of commands, I was able to achieve the main functionality, but it is dirty. I would be grateful for your help in streamlining.
Here's what I'm doing right now (bear with me, and I promise to be as clear as possible):
I load the data into a desktop folder called "DataInbox", where I also have the following shell script saved as newdata.sh:
#!/bin/bash if [[ -z "${1}" ]]; then die "FolderName Required" fi /bin/mkdir -p ~/Desktop/DataFarm/$1/{ProtectedOrig,Data} echo -n "---Data Folder Setup ---Data Introduction ---Data Audit/Manipulation ---Data Queries" > ~/Desktop/DataFarm/$1/Data/DataJournal.txt
By executing bash newdata.sh DirectoryName , I create a directory with subfolders "Data" and "Protected Orig" and a text file "DataJournal.txt" with four headers.
Inside the DataInbox directory, I run this mess, only strung together with && :
$ ditto NewData/ NewDataCopy $ bash newdata.sh DirectoryName $ mv NewData/ /Users/JSG/Desktop/DataFarm/DirectoryName/ProtectedOrig/NewData $ mv NewDataCopy/ /Users/JSG/Desktop/DataFarm/DirectoryName/Data/NewDataCopy $ chflags -R uchg /Users/JSG/Desktop/DataFarm/DirectoryName/ProtectedOrig/
As I said, I would like to rationalize this. In fact, what I really would like to do is turn all this into a shell script, and I'm struggling to get it to work. Thank you in advance from a beginner to beginner.