Hello, I am still pretty new at writing shell scripts and may have bitten off more than I can chew. I am trying to write a script that figures out if a file exists (a known name) in directory a, then copy it to my selected destination, otherwise, look in directory b and check there. If it is in neither place, I'd like an output saying that it was not copied/doesn't exist. I need to be able to do this for multiple files that may be in either directory a or b.
I am currently trying to pass my user requested inputs into an array and have a for loop operate on each member of the array but I am not sure I am doing either part quite right and I'd like to know if what I'm doing will even work before I pour tons of hours into it. Currently, my script copies the first file I list (happens to be in directory a), then gives the error, "Bad escape character" and lists the file path for directory b with the already copied file from directory a. My code is not on this pc, so I'd have to manually transcribe it and I will if I must.
Any help is greatly appreciated.
---------- Post updated at 10:44 PM ---------- Previous update was at 10:04 PM ----------
Hi Frineds,
Through my DTS process I am generating one file at one directory like,
/sqlsrvr_demo/dts/put/transaction_fact.csv
now I want to copy this files(only when the files size is greater than 0 kb) to some other directory like
/sqlsrvr_demo/dts/get/transaction_fact.csv
Can... (2 Replies)
Hi
I am in a situation to write a shell script that looks for the flat files continuosly and if files exists in that directory sort on the files and get the latest file(File comes with timestamp at the end) and copy the latest file to the other directory and again copy the next one to the same... (0 Replies)
Hi All,
I have a file that gives me new line/output every 5 minutes. I need to create a script that capture new line/output besides "IN CRON_STATUS", in this case the new output is "begin ------ cron_status.sh - -----------".
I want this script to capture the line starting from "begin ------... (0 Replies)
hi,
i want copy one or group of file from a computer to others, but i have some problem that do not allow me to do this.
i do this by scp command like this :
scp <file name> root@cpName:destinationAddress
but the problem is that it do not it automatically. it means when it is connecting to... (4 Replies)
Compete noob question....
I need a script to search through a directory and find files containing text string abcde1234 for example and then copy that file with that text string to another directory
help please :eek: (9 Replies)
Can you please help on this?
I am looking for the shell script which does following:-
step 1: It should open the file /u/manish/input/FileIndex.dat and read line by line
step 2: Once first line is read (for ex: File1), we have to find a file, that contains this matching... (4 Replies)
HI Guys
whenever i post a transaction , abcd.in file is stored in the temp and vanishes when the transaction is compleated . the abcd.in file stays for 1 sec in temp is der any solution to capture the abcd.in file to another directory
cp -r /tmp/abcd.in /tmp/smith.in
when i used the... (1 Reply)
Dear all,
I have a database with thousands of files with the structure of name is:
Filename_hour_year.abc
Filename_hour_year_1.abc
..............
So what I need is how to write a script that all file with contain the character "_1" will copy to "_2"
For example: file name:... (7 Replies)
Looking for help on a script that does the following. Reads a text file with ~5000 lines that look something like this:
/folder/path/path2/pathX/file.lua,d/1.2699.gz
/folder/path/path4/pathX/file2.lua,d/1.2699.gz
/folder/path/path2/pathX/data/file3.lua,d/1.2699.gz
And copies the file from... (8 Replies)
Hello All,
This is my first post to unix.com.
I have requirement to copy multiple *.dmp files from one server to other server.
I have that other server NFS filesystem mapped to source server.
Dump files are so huge almost 20TB. There are around 15-20 files each of 1.1TB.
I want to copy these... (6 Replies)
Discussion started by: Amit Bansode
6 Replies
LEARN ABOUT OSF1
rmtrashcan
mktrashcan(1) General Commands Manual mktrashcan(1)NAME
mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches, or shows a trashcan directory
SYNOPSIS
/usr/sbin/mktrashcan trashcan directory...
/usr/sbin/rmtrashcan directory...
/usr/sbin/shtrashcan directory...
OPERANDS
Specifies the directory that contains files that were deleted from attached directories. Whenever you delete a file in the specified
directory, the file system automatically moves the file to the trashcan directory. Specifies the directory that you attach to a trashcan
directory.
DESCRIPTION
The trashcan utilities (mktrashcan and rmtrashcan) enable you to attach or detach an existing directory, which you specify as a trashcan
directory, to any number of directories within the same fileset.
A trashcan directory stores the files that are deleted with the unlink system call. For instance, you can use the mktrashcan utility to
attach a trashcan directory called /usr/trashcan to one or more directories; thereafter, when you delete a file from one of the attached
directories, the file system moves the file to the /usr/trashcan directory. Note that when more than one directory shares attachment to a
trashcan directory, files with the same file name can overwrite each other in the trashcan directory.
If you mistakenly delete a file, use the mv command to return the file from the /usr/trashcan directory to its original directory.
When you enter shtrashcan at the system prompt, the system shows the trashcan directory, if one exists, for the directory you specified.
It is important that trashcan directories have correct access permissions. If the permissions are too restrictive, then it may be impossi-
ble to remove files from the directories that are attached to the trashcan directory. In general, all users and groups that expect to use
the trashcan directory need write permission to the directory. If unexpected "permission denied" errors occur when deleting files that are
in a directory attached to a trashcan directory, use the chmod command to change the permissions on the trashcan directory.
RESTRICTIONS
The directory and trashcan directories must be in the same fileset; however, you can attach the trashcan directory to any directory within
the fileset.
EXAMPLES
The following example creates and attaches a trashcan directory, /usr/trashcan, to two directories, /usr/ray and /usr/projects/sql/test,
which are in the same fileset. The chmod command adds write permission for all users and groups on the new trashcan directory. % mkdir
/usr/trashcan % chmod a+w /usr/trashcan % mktrashcan /usr/trashcan /usr/ray /usr/projects/sql/test To attach the trashcan directory,
/usr/trashcan, to all subdirectories in the /usr directory, enter: % mktrashcan /usr/trashcan /usr/*
New subdirectories that you add beneath the /usr directory are not attached to the trashcan directory until you attach them. Also,
the mktrashcan utility distinguishes between directories and files, attaching only directories to the trashcan directory.
Note that an attached directory produces an EDUPLICATE_DIRS (-1165) error when /usr/trashcan is itself in the directory path you
attach to (as in the previous example). You can ignore this error message.
SEE ALSO advfs(4), mkfset(8), showfsets(8)mktrashcan(1)