Scripting Help
Hello everybody,
I have a script written below that currently will write a single file to an archive that returns an "object ID" to a text file. It works great. What would be better is if it would write sequential files from a directory i have called "pics", and pass the original filename to associated with the ObjectID to the output file. I'm stuck with this. Any ideas? Thanks for the help. ___________________________________________________ USERNAME="dee" TARGET_IP="10.20.30.40" ARCHIVE_NAME="data1" SOURCE_FILE="/Users/dee/scripts/image.png" OUTPUT_FILE="/Users/dee/scripts/output/objectID.txt" PASSWORD="password" while true do curl -# --tcp-nodelay -u $USERNAME:$PASSWORD -T $SOURCE_FILE -w "Object Size %{size_upload} bytes, Transfer Rate %{speed_upload} bytes/s, Time %{time_total} secs\n\n" http://$TARGET_IP/$ARCHIVE_NAME | tee -a $OUTPUT_FILE done |
A useful construction to cycle through all files in a directory
Hi -- Here is a suggestion for you. I often want to operate on a bunch of files in sequence
Code:
USERNAME="dee" Obviously you can ls whatever you want, including * |
I'll bet you could also do something like
Quote:
sort is a great linux shell built-in. |
Please do not use ls in this manner when globbing will not incur the issues you may face. See here for more details.
|
grail makes a useful point. Didn't know about the newline issue with ls. I've been using this construction
for years for my own work with no problem, but, by design, I never have filenames with newlines or spaces in them. |
All times are GMT -5. The time now is 08:27 PM. |