Take a folder name and find it in another folder (Complicated)
Hi Script Experts,
Here is my scenario:
1. /var/mqm/qmgrs folder will contain 11 folders as follows:
1. /var/mqm/qmgrs/Folder_Name1
....................../Folder_Name2
....................../Folder_Name3
.......
...................../Folder_Name11
2. if Folder_Name1 exists in /export/home/mqm/DR/ini/Folder_Name1
then delete Folder_Name1 from step 1. /var/mqm/qmgrs folder
3. Go back in the loop, take Folder_Name2 and perform step 2. until all 11 Folder_Name11
NOTE:
I did ls -1 /var/mqm/qmgrs/. which is giving me a list of Folder_Name1 thru Folder_Name11
I don't know how to take Folder_Name1 value and see if it exists in step 2 folder.
If somebody can help me here would be highly appreciated!!!
You are just giving a message to the screen telling the user which dir you are removing. 'PWD' would contain the value of current directory. Just
and see.
Thank you so much for all your help. It is working great. I really appreciate it.
I have a similar situation where I like do the following:
Here is my scenario:
1. /var/mqm/qmgrs folder will contain 11 folders as follows:
1. /var/mqm/qmgrs/Folder_Name1
....................../Folder_Name2
....................../Folder_Name3
.......
...................../Folder_Name11
2. if Folder_Name1 exists in /export/home/mqm/DR/ini/Folder_Name1
then update a LogPath line in qm.ini file within /var/mqm/qmgrs/Folder_Name1/qm.ini file
3. Go back in the loop, take Folder_Name2 and perform step 2. until all 11 Folder_Name11
NOTE:
This is what I tried, it is generating a new file under /var/mqm/qmgrs but NOT updating the LogPath line in the qm.ini file.
Looks like my sed is NOT working properly. If I try the same sed replacing Folder_Name as follows, it is working fine.
sed -e '/^ LogPath/s/LogPath=\/var\/mqm\/log\/CIBOTSP\/CIBOTSP\//
LogPath=\/var\/mqm\/log\/CIBOTSP\//' qm.ini.new > qm.ini
Could you please help me out here.
Warm Regards,
Khan
Last edited by blowtorch; 09-06-2006 at 01:20 PM..
Reason: add code tags
Not really able to understand what you are doing in that sed there. Why don't you give an example for one directory name and then someone could help you with what you want.
Here's a tip: when using sed to match/replace for pathnames that contain the "/" character, don't use the "/" as the delimiter/seperator for the sed commands. Use something like "#" instead.
works just as well as the more traditional
Hi,
I have a script doing backup to synology server, the script create new folder each day with the date as being folder name i.e. 2018-07-30. Just before creating the new folder I want the script to find the oldest folder from the list and delete it including its content.
for example... (3 Replies)
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
I need help to write shell script to copy files from one server to another server.
Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Hi all I'm new to your forum but not new to shells. I'm having a little trouble though as it's been quite some time since I scripted. Here's what I'm trying to do:
I'm trying to search a directory named '/var/root/Applications' for another directory 'fooBar'. The "Applications" directory... (9 Replies)
Hi all,
*I use Uwin and Cygwin emulator.
I´m trying to search for all text files in the current folder (C/Files) and its sub folders using
find -depth -name "*.txt"
The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
This is the file structure:
DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg
DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg
DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg
DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg
DESKTOP/Root of Photo... (4 Replies)
Hi,
I want to extract myfile.war to a folder which is in the same folder with war file.I did this as normal:
jar -xvf myfile.war
But it exploded all the content of file to the same level folder instead of that I was expecting to create a folder called myfile.
This works with tar:
... (0 Replies)
Hello,
I am an amature at UNIX commands and functionality.
Please could you all assist me by replying to my below mentioned querry :
How can I upload a zip folder on a unix path from my windows folder?
Thanks guys
Cheers (2 Replies)
Hello all,
I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written.
I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)