Sponsored Content
Full Discussion: Multiple stage file move?
Top Forums UNIX for Dummies Questions & Answers Multiple stage file move? Post 302169265 by Smiling Dragon on Wednesday 20th of February 2008 05:16:51 PM
Old 02-20-2008
Java

Your solution (you'll probably need to wrap some additional logic and error handling etc round this):
Code:
#!/bin/sh
THEMEDDIR=/export/home/httpd/themes
HTMLDIR=/export/home/httpd/htdocs
FILE=header.jpg
THEME=xmas

if [ -r $HTMLDIR/$FILE ]
then
  cp -p $HTMLDIR/$FILE $THEMEDIR/${FILE}.default
  cp $THEMEDIR/${FILE}.${THEME} $HTMLDIR/$FILE
fi

An alternative approach - use symbolic links:
Code:
#!/bin/sh
HTMLDIR=/export/home/httpd/htdocs
FILE=header.jpg
if [ -r ${HTMLDIR}/${FILE}.$1 ]
then
  rm -f ${HTMLDIR}/${FILE}
  ln -s ${HTMLDIR}/${FILE}.$1 ${HTMLDIR}/${FILE}
else
  echo "$1 version of $FILE not found!"
  exit 1
fi

Usage: scriptname.sh <theme>
Where theme is something like 'xmas' or 'default' etc.

Them just have a copy of the header.jpg file for each theme (eg header.jpg.xmas), including the plain one called header.jpg.default.
Run this script to switch to whatever one you need.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move multiple files

Hi all .. I am trying :- #! /bin/sh # Archives target file ftp'd to SAP ECC srcfiles=/usr/dw/apps/work/PROJECT_NEW/SrcFiles/$1/*.txt tgtfiles=`ls /usr/dw/apps/work/PROJECT_NEW/TgtFiles/FTP/$1/*.txt` for i in $tgtfiles do mv $i /usr/dw/apps/work/PROJECT_HUDSON/archive/Tgt/$1/$i_`date... (3 Replies)
Discussion started by: jmahal
3 Replies

2. UNIX for Advanced & Expert Users

Move folders from Multiple remote Servers to my local computer

I have 20 Servers (They are Windows 2003) that I remote every day using names or IP address and type in my username & Password then copy folders manually to my local computer. I'm wondering if i can just run script(s) from my local computer to do this job without using FTP(because of security... (5 Replies)
Discussion started by: idiazza
5 Replies

3. Shell Programming and Scripting

To move multiple files to a new folder everytime

Hi , Below is the scenario A.txt B.txt C.csv .......... i want to move all the above files in to a new path & new folder .This folder is created based on date(for ex: today's fodler name will be 20120222).for Everyday move a new folder based on date has to be created & this folder... (1 Reply)
Discussion started by: jagadeeshn04
1 Replies

4. Shell Programming and Scripting

Script to compare substrings of multiple filenames and move to different directory

Hi there, I am having trouble with a script I have written, which is designed to search through a directory for a header and payload file, retrieve a string from both filenames, compare this string and if it matches make a backup of the two files then move them to a different directory for... (1 Reply)
Discussion started by: alcurry
1 Replies

5. Shell Programming and Scripting

Script to move files in multiple folders

Hello all, I would appreciate any help to write a script. I have folder A which contains over 30 thousands xml files, I would like create multiple folders and move those files (500 in each folders). Thank you (1 Reply)
Discussion started by: mmsiddig
1 Replies

6. UNIX for Dummies Questions & Answers

Move Multiple Files adding date timestamp before file type

There are files in a directory and I have to move multiple files adding datetimestamp before the file type. /Data/ abc.csv def.csv ghi.csv I have to move this files to archive directory adding datatimestamp before .csv /archive/ abc_YYYYMMDDHHMMSS.csv def_YYYYMMDDHHMMSS.csv... (7 Replies)
Discussion started by: eskay
7 Replies

7. Shell Programming and Scripting

Sort and move multiple files by modification date

Hi I have a problem, I have a large group of archive files in a folder some are later versions of the same archive, the only difference btween them is that the archiving program we use appends the name with a code for it to keep track of in its data base, and the modification date. I am starting... (6 Replies)
Discussion started by: Paul Walker
6 Replies

8. Shell Programming and Scripting

Move multiple files 4rm Source to different target folders based on a series num in the file content

Dear Experts my scenario is as follows... I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims". All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies

9. Shell Programming and Scripting

Move multiple files to different directory using a single command

I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server). I have tried the following but it gives error ... (5 Replies)
Discussion started by: Soham
5 Replies

10. Shell Programming and Scripting

Rename (move) multiple files on remote server using sftp

I want to rename (move) multiple files on remote server. I tried the following command to move all TXT files from my_dir directory to /new_dir. But it does not work. Any help? #!/bin/ksh sftp -dev3 << ABC cd my_dir $(for i in TXT; do echo "ls *.$i" ; rename $x /new_dir/$x;... (1 Reply)
Discussion started by: Soham
1 Replies
curs_move(3)						     Library Functions Manual						      curs_move(3)

NAME
curs_move, move, wmove - Move the Curses window cursor SYNOPSIS
#include <curses.h> int move( int y, int x ); int wmove( WINDOW *win, int y, int x ); LIBRARY
Curses Library (libcurses) STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: move, wmove: XCURSES4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
These routines move the cursor associated with the Curses window to line y and column x. They do not move the physical cursor of the ter- minal until refresh is called. The specified position is relative to (0,0), which is the upper left-hand corner of the window. NOTES
The header file <curses.h> automatically includes the header file <stdio.h>. Note that move may be a macro. RETURN VALUES
These routines return the integer ERR upon failure and OK upon successful completion. SEE ALSO
Functions: curses(3), curs_refresh(3) Others: standards(5) curs_move(3)
All times are GMT -4. The time now is 09:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy