Sponsored Content
Top Forums Shell Programming and Scripting Moving file(s) from dir to dir Post 302279277 by manas_ranjan on Thursday 22nd of January 2009 09:49:47 AM
Old 01-22-2009
hey I am providing you the below skeleton of your requirement, going forward please modify it as per your requirement
Code:
no_param=$#

if [ ${no_param} -ne 1 ]
then
	echo "Please execute the script with i/p as i(single) or a(all),"
	echo "`basenmae $0` i or a "
	exit 1
fi

case $1
in
"a") 	for i in $(ls -1 <input dir>| grep -v "^\.")
	do
	mv <input dir>/$i  <destination dir>	
	done
	;;
"i")    echo "please type the file you want to move"
	read input_file
	if [ ! -f "<input dir>/${input_file}" ]
	then
		echo "${input_file} doesn't exist."
		exit 1
	else
		mv <input dir>/${input_file} <destination dir>	

	fi
	;;
*)	echo "please enter your input correctly."
	exit 1
	;;
esac

NOTE: I have not tested it in any environment.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies

2. Shell Programming and Scripting

copying a file from one dir to another dir

hi i have a script compareFiles() { find /tmp/Satya -type f | \ while read filename1 do echo "----------------------------------------$filename1" find /tmp/Satya -type f | \ while read filename2 do if diff $filename1 $filename2 then echo "Both files... (3 Replies)
Discussion started by: Satyak
3 Replies

3. Shell Programming and Scripting

moving dir subdir and files

I have created a directory structure and under the directory subdirectories and files are there.I need to move the entire thing to another path.How can i write a script to do that. currently the path of files is as below : /data1/serial/mcycle/archive : under this path differnt sub dir exist ... (6 Replies)
Discussion started by: dr46014
6 Replies

4. Shell Programming and Scripting

Moving file from one dir to Another with Given Qualifier

Hi, I want to Move files from one dir to another dir on same mount point. The source dir may contain subdir or files within it. Search the files or subfolder which is older then a given datetime . Move the file recursively and after each successful move of file make an entry to log... (2 Replies)
Discussion started by: rkmbcbs
2 Replies

5. UNIX for Dummies Questions & Answers

Copying dir (and sub dir) file names from ftp server to txt file in diff server

Hey all, i want to copy only the file names from an ftp server (directory and all sub directory) to a text file in another server (non ftp), i.e. i want to recursively move through directories and copy only the names to a text file. any help is appreciated...thank you in advance (1 Reply)
Discussion started by: deking
1 Replies

6. Shell Programming and Scripting

moving files from a dir in one machine to a dir in another machines

Hi, I am a unix newbie.I need to write a shell script to move my oracle READ WRITE datafiles from one serevr to another. I need to move it from /u01/oradata/W1KK/.. to /u01/oradata/W2KK, /u02/oradata/W1KK/.. to /u02/oradata/W2KK. That is, I actaully am moving my datafiles from one database to... (2 Replies)
Discussion started by: mathews
2 Replies

7. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

8. Shell Programming and Scripting

Problem with moving a file to another dir.

Hi frnds The following is the code #!/bin/ksh ############################################################## # # # Created by eDB Dev - 27-May-2011 # # ... (1 Reply)
Discussion started by: balesh
1 Replies

9. Shell Programming and Scripting

Create file Dir and Sub Dir same time

Hi Guys , I want create files Dire and Sub Dire. as same time using variable. EX: x1="/hk/Pt/put/NC/R1.txt" x2="/hk/pt/Put/Ot/NC/RN.txt" And i want delete all after done with my script. Thanks (2 Replies)
Discussion started by: pareshkp
2 Replies

10. AIX

Assign read write permission to the user for specific dir and it's sub dir and files in AIX

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies
LIPO(1) 						      General Commands Manual							   LIPO(1)

NAME
lipo - create or operate on universal files SYNOPSIS
lipo [-info] [-detailed_info] [-arch arch_type input_file] ... [ input_file] ... [-arch_blank arch_type] [-create] [-thin arch_type] [-replace arch_type filename] ... [-remove arch_type] ... [-extract arch_type] ... [-extract_family arch_type] ... [-verify_arch arch_type ...] [-output output_file] [-segalign arch_type value] ... DESCRIPTION
The lipo command creates or operates on ``universal'' (multi-architecture) files. It only ever produces one output file, and never alters the input file. The operations that lipo performs are: listing the architecture types in a universal file; creating a single universal file from one or more input files; thinning out a single universal file to one specified architecture type; and extracting, replacing, and/or removing architectures types from the input file to create a single new universal output file. Only one option can be specified, with the exception of -arch, -arch_blank, -output, and -segalign, which are used in combination with other options. The input_file argument is required, and only the -create option allows more than one input_file to be specified. The -output flag must be used, except with the -info and -detailed_info flags. The arch_type arguments may be any of the supported architecture names listed in the man page arch(3). OPTIONS
-info Briefly list the architecture types in the input universal file (just the names of each architecture). -detailed_info Display a detailed list of the architecture types in the input universal file (all the the information in the universal header, for each architecture in the file). -arch arch_type input_file Tells lipo that input_file contains the specified architecture type. The -arch arch_type specification is unnecessary if input_file is an object file, a universal file, or some other file whose architecture(s) lipo can figure out. -arch_blank arch_type Specifies that the output for the specified arch_type will be an MH_DYLIB_STUB file. This flag may not be used with any operation other than -create. -output output_file Specifies its argument to be the output file. -create Take the input files (or file) and create one universal output file from them. -thin arch_type Take one input file and create a thin output file with the specified arch_type. -replace arch_type file_name Take one universal input file; in the output file, replace the arch_type contents of the input file with the contents of the speci- fied file_name. -remove arch_type Take one universal input file and remove the arch_type from that universal file, placing the result in the output file. -extract arch_type Take one universal input file and copy the arch_type from that universal file into a universal output file containing only that architecture. -extract_family arch_type Take one universal input file and copy all of the arch_types for the family that arch_type is in from that universal file into an output file containing only those architectures. The file will be thin if only one architecture is found or universal otherwise. -verify_arch arch_type ... Take one input file and verify the specified arch_types are present in the file. If so then exit with a status of 0 else exit with a status of 1. -segalign arch_type value Set the segment alignment of the specified arch_type when creating a universal file containing that architecture. value is a hexa- decimal number that must be an integral power of 2. This is only needed when lipo can't figure out the alignment of an input file (currently not an object file), or when it guesses at the alignment too conservatively. The default for files unknown to lipo is 0 (2^0, or an alignment of one byte), and the default alignment for archives is 4 (2^2, or 4-byte alignment). SEE ALSO
arch(3) Apple Computer, Inc. September 12, 2006 LIPO(1)
All times are GMT -4. The time now is 06:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy