Sponsored Content
Top Forums Shell Programming and Scripting Parse the .txt file for folder name and FTP to the corrsponding folder. Post 302124636 by frijofranco on Monday 2nd of July 2007 03:10:11 AM
Old 07-02-2007
Try this

#!/usr/bin/ksh
ls -1 *file.txt | while read FILENAME
do
DIRNAME=`echo "$FILENAME" | sed -n 's/........\(.*\)file.txt/\1/p'`
echo "starting FTP of $FILENAME to Directory /tmp/$DIRNAME ..."
ftp -v -n host <<EOF
user user pwd
cd /tmp/$DIRNAME #destination Dir
lcd /tmp/source/ #source dir
put "$FILENAME"
bye
EOF
done
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving a file to a new folder and automated ftp

how to move a file to a different folder after an automated FTP . (1 Reply)
Discussion started by: dineshr85
1 Replies

2. Shell Programming and Scripting

Move the file from one folder to another folder

Hi, I have a requirement to move a file from one folder(a) to another folder(b) only when folder (b) have a write permission. Folder permission is 755 If the permission is otherthan 755 we need to come out of the loop I will appreciate your help Thanks Soll (1 Reply)
Discussion started by: sollins
1 Replies

3. Shell Programming and Scripting

how to FTP a file from the local folder to unix server

Hi All, please help me to write a shell that ftp a file which is in the local (C:\) drive to a Unix server. Where as i know the IP for the Unix server. i could do this process by using ftp command. pls help me to write as Shell script. Thanks in advance for all of your answers.:b::b: (3 Replies)
Discussion started by: little_wonder
3 Replies

4. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

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)
Discussion started by: guptaxpn
4 Replies

5. Shell Programming and Scripting

How to copy specific file.txt in specific folder?

hye there... i have a problem to copy file in specific folder that will change the name according to host,time(%m%s) and date(%Y%M%D) example folder name: host_20100531.154101801 this folder name will always change... but i just want to copy the AAA.txt and BBB.txt file.. really need... (17 Replies)
Discussion started by: annetote
17 Replies

6. Shell Programming and Scripting

want to move set of file from one folder to another folder

Hi all, let me explain my requirments i am having 5 folder with different name for eg) abc , cdf , efd, rtg, ead each 5 folders contain 15 files i want to move 10 files to some other folder, remain 5 files should be there in the same folder. give me some suggestion on this. (6 Replies)
Discussion started by: natraj005
6 Replies

7. Shell Programming and Scripting

Bash script for new file in ftp folder

Hello, I'm trying to make a bash script that send me e-mail if there is any new file in my ftp folder. cat inotify.sh #!/bin/sh /usr/bin/inotifywait -e create \ -mrq /home/mrowcp | while read line; do echo -n "$line " >> /var/log/inotify.log echo `date | cut -d " " -f1-4` >>... (3 Replies)
Discussion started by: mrowcp
3 Replies

8. Shell Programming and Scripting

Perl script to parse all files in the folder

Hello Smart People! I have a perl script that will import xml data into an access db. I would like to modify it so it will automatcially parse through all xml files in the folder. I swa a post but couldnt get it working. her is what my scrip looks like, i only list the top if you need more... (3 Replies)
Discussion started by: cowboymaverick
3 Replies

9. Shell Programming and Scripting

read (filenam.txt) then go to folder and delete (charactername.bic)

I am hosting a nwserver.That is a Neverwinter Nights game server on linux Ubuntu 11.04 server. I need help creating a script to read a .txt and retrieving character logins and character names. The game will make a .txt in folder home/nwn/(filenam.txt). Then I will make a crontab job to... (0 Replies)
Discussion started by: 222222quick
0 Replies

10. Shell Programming and Scripting

Shell scripting for moving folder specific files into target directory of that country folder.

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)
Discussion started by: naresh2389
3 Replies
DIRNAME(1)							   User Commands							DIRNAME(1)

NAME
dirname - strip non-directory suffix from file name SYNOPSIS
dirname NAME dirname OPTION DESCRIPTION
Print NAME with its trailing /component removed; if NAME contains no /'s, output `.' (meaning the current directory). --help display this help and exit --version output version information and exit EXAMPLES
dirname /usr/bin/sort Output "/usr/bin". dirname stdio.h Output ".". AUTHOR
Written by David MacKenzie and Jim Meyering. REPORTING BUGS
Report dirname bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
basename(1), readlink(1) The full documentation for dirname is maintained as a Texinfo manual. If the info and dirname programs are properly installed at your site, the command info coreutils 'dirname invocation' should give you access to the complete manual. GNU coreutils 7.1 July 2010 DIRNAME(1)
All times are GMT -4. The time now is 05:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy