how to copy a file to a directory ,where file and dir are sent as args to a function?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to copy a file to a directory ,where file and dir are sent as args to a function?
# 1  
Old 06-08-2008
how to copy a file to a directory ,where file and dir are sent as args to a function?

Hi all,

I wanted to know how i can copy a file to a directory and then verify if that file is completely copied or not?
Now the issues here is that the dir and the source file are to be sent as arguments to a function( this function should actually copy the files to a dir, then check if its completely copied)

I dont want to use the

if [ -e <filename>]
option then figure out if the file exists in the dir or not....
Reason being i am giving a progress bar that actually calculates the % of completion....
I have written scripts that do the job ,but a pre-requisite is that a file already needs to exist in the dir, then to this file i can copy my source file.

But my idea is to have no files in the targeted dir ,and when the cp is done the source file should exist in the destination dir!!!!

please help!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Switching between directories and mkdir/copy dir/file

I was trying to copy the files inside the path /home/user/check/Q1/dir/folder1/expected/n/a1.out1 and a1.out2 and a1.out3 to /home/user/check/Q2/dir/folder1/expected/n/ if n directory is not present at Q2/dir/folder1/expected/ then directory should be created first. And, script follow the... (5 Replies)
Discussion started by: Mannu2525
5 Replies

2. UNIX for Dummies Questions & Answers

Issues in Csv file transfer copy from one dir to another

Hi Unix community, I got this code from you guys and I tried to modify it to use for my csv dir transfer basically i want the .csv file to copy itself and populate it to the archive dir. #!/bin/ksh dir1="/home/pumela/unixtestprod" cd "$dir1" echo "code is running" for srcd in... (13 Replies)
Discussion started by: phumaree
13 Replies

3. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

4. Programming

how to copy file to a directory

Hello, I've been spending a lot of hours trying to imitate cp copying a file to a directory. cp I just can't seem to write to a specified directory, it only creates a copy on the current directory. any hints/tips will help! Thanks! here's the code i've been trying to manipulate: ... (1 Reply)
Discussion started by: l flipboi l
1 Replies

5. Shell Programming and Scripting

Copy files from input file with dir structure

hi, I want to copy files from source directory based on input file (or output of previous command) and i want to have the SAME DIRECTORY STRUCTURE. Note that i will have other files and directories which i dont want to copy to destination. For example, dir source has following content:... (22 Replies)
Discussion started by: dragon.1431
22 Replies

6. UNIX for Dummies Questions & Answers

How to copy a file to a directory?

Hello all, I've been researching this problem for days, and have gotten no luck . =/ How do you copy a file to another directory without being in the same directory as the file? So, for example, say I wanted to copy the file 'my.txt' that is in the directory ' /export/hom0/user/asdf ' to the... (9 Replies)
Discussion started by: kvnqiu
9 Replies

7. Shell Programming and Scripting

Copy Files to Dir and Check If File Exists

Hi everyone. I am trying to write a bash script that will copy files from one directory to another but I need to be able to check the directory that I'm copying the files to and see if the file already exists. If it does I need to add a number at the end of the copied file. Thanks for your help. (3 Replies)
Discussion started by: snag49ers
3 Replies

8. UNIX for Dummies Questions & Answers

Copy dir/file from one place to another.

Hello all. I'm not getting the hang of Paths. I have a dir w/files that I want to copy to another dir. Right now I am in the "source" directory. I want to copy it to Ch7. "cp -r source Ch7". Ch7 was already created. 1st msg.: cannot stat `source`: No such file or dir. I typed pwd & got... (3 Replies)
Discussion started by: Ccccc
3 Replies

9. 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

10. Shell Programming and Scripting

to write a script to compare the file size in the current directory and previous dir

hi, i am new to this site. i want to write a script to compare the file size of the files in the current dir with the files in the previous directory. the files name will be same, but the filename format will be as xyzddddyymm.txt. the files will arrive with the month end date(i want to... (5 Replies)
Discussion started by: tweety
5 Replies
Login or Register to Ask a Question
JH_SETUPENVIRONMENT(1)						    Javahelper						    JH_SETUPENVIRONMENT(1)

NAME
jh_setupenvironment - Prepares a build environment to compile an eclipse feature. SYNOPSIS
jh_setupenvironment [debhelperoptions] [--pde-build-dir=dir] [copy[...]] DESCRIPTION
jh_setupenvironment is a javahelper program that handles creating an environment for building an eclipse feature. It does not setup an orbit dir (use jh_generateorbitdir for that). It will copy files specified in debian/eclipse.environment as well as those given on command line into the environment dir. If no files are given per command line and the environment file is not present (or is empty), it will default to "org.eclipse.*" FILES
debian/eclipse.environment List of file- and directory glob patterns to copy into the build environment. OPTIONS
--pde-build-dir=dir Specifies where the environment should be or is placed. --clean If passed, jh_setupenvironment will clean up the build environment. When cleaning jh_setupenvironment will not record itself in the debhelper log to avoid confusing dh, when it has to use the log to trace where it was. EXAMPLE
jh_setupenvironment org.eclipse.* debian/*.properties Will clone all files and folders starting with "org.eclipse." and all property files in the debian-folder and put them into the environment. SEE ALSO
debhelper(7) This program is a part of javahelper and uses debhelper as backend. There are also tutorials in /usr/share/doc/javahelper. AUTHOR
Niels Thykier <niels@thykier.net> COPYRIGHT AND LICENSE
Copyright 2010 by Niels Thykier This tool is free software; you may redistribute it and/or modify it under the terms of GNU GPL 2. 0.43 2011-02-17 JH_SETUPENVIRONMENT(1)