Now following on from renaming the files of interest (fna.gz) I now need to loop through folder1.
As I loop through folder1 I am trying to first of all capture the first word in the file before the first underscore, for example if the folder name is /Long_John_Silver/ then I am trying to capture only "Long".
Then I want to check whether there is a folder with the same name "Long" in a distant directory /another/directory/ and if there is then a move onto the next folder in folder1, but if there isn't then I create a new folder with the captured name i.e. "Long".
Here's my work so far, I am struggling with the capturing of "Long" part.
Notice how most references to basenm, fldr and newdir are quoted, this is necessary if any of your folder names could ever contain white space characters (like space or newline).
There is no need to cd into /another/directory to create folders, and doing this will cause the next loop to fail, so just pass the full directory path to mkdir and keep the current directory where it is.
This User Gave Thanks to Chubler_XL For This Post:
Hi,
I make a sftp connection successfully.My requirement is the script shall execute only after i find a trigger file(dailyreport.OK.psv) in the remote dir. If the trigger file is not present ,the script should exit else it should continue with the rest of the scripts statements. Below code is... (13 Replies)
I have an HP-UX server that runs a script each night. The script connects to an SFTP server and downloads all xml files (if any are present) from a certain folder, and then deletes the files from the SFTP server. So sometimes it will download a new file, sometimes it will download 2 or 3 new... (4 Replies)
Hi,
Following script work fine:
#!/bin/bash
FILE=$1
if ; then
echo Yay
else
echo Boo
fi
But I would like to add another condition that if FILE... (3 Replies)
My script is taking a file "input.in" as input for running the script. My worry is that i need to execute the script only if the file is present, if it's not don't perform the next commands.
Just to have a check at the beginning of the script : If "input.in" exists, then go on. If it's does not... (4 Replies)
Hi,
My os is sun solaris 5.10 and Korn shell scripting.
I have a file name like CCNA_EARLY_SWP.w062309
where 062309 is date in mmddyy .This is the value date of the file.(will
I need to check continously from 5.00 - 7.00 am daily for this file .
If the file has not come at 5 am or 7am... (4 Replies)
Is there code in Cshell scripting to check for the presence of any files in the current directory (and only the current directory)? I tried:
if (-r *) then ...
but Cshell doesn't like that.
Thanks,
Paul Hudgens (0 Replies)
I have tried the following script to check for the presence of any files in a folder:
if (-r *) then
goto ZipMiscFiles
else
echo ""
echo " No Miscellaneous files found. Exiting program."
echo ""
exit
endif
The -r works fine with the wildcard in combo with other... (4 Replies)
I have a shell script which GETS a file, but I only want to run this script if $FILE exists on the remote host, don't know correct syntax.....please help
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
bin
get $FILE
rename export.prn export.prn.$TIMESTAMP
!cat... (0 Replies)