Results 1 to 7 of 7

Thread: Linux / Unix: Copy A File With Directory

  1. #1
    Member
    Join Date
    Apr 2012
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Exclamation Linux / Unix: Copy A File With Directory

    Simply I Need to do the below task.

    there is file called A.txt in letters directory.

    letters/A.txt

    i want to copy this file with its directory in to a another directory called numbers.

    so i have tried its not working out .

    need a helping hand to sort this out.

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    Hyderabad, AP, India
    Posts
    806
    Thanks
    44
    Thanked 55 Times in 48 Posts
    Rep Power
    13

    Default

    did you try
    mv letters/ destfolder/

    ?
    Thanks,
    Surendra Kumar Anne
    Linux: Fast, friendly, flexible and .... free!
    Support Open source.
    http://www.linuxnix.com

  3. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    453
    Thanks
    0
    Thanked 62 Times in 58 Posts
    Rep Power
    10

    Default

    hi

    tar is able to do such a thing.
    now you know what program to use, you'll easily find, searching the web, how to do it.
    A problem clearly stated is a problem half solved.

  4. #4
    Member
    Join Date
    Apr 2012
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    for FNAME in `cat /home/myworks/ca.txt`
    do
    ssh servername "tar cvf /tmp/test.tar $FNAME"
    done

    i used above but im getting below error :

    tar: cannot open install/CDEV-2876-Rollback.r
    tar: cannot open util/assetCntDrv.r

    please explain me ...

  5. #5
    Senior Member
    Join Date
    Aug 2011
    Posts
    453
    Thanks
    0
    Thanked 62 Times in 58 Posts
    Rep Power
    10

    Default

    what does ssh have to do with your first post.

    you explain precisely what exactly you're trying to do.


    first: read data from a file line by line:
    Code:
    while read line
    do
      echo "echo or do stuff with $line"
    done < file
    A problem clearly stated is a problem half solved.

  6. #6
    Member
    Join Date
    Apr 2012
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Alright,

    i have need to create a tar in remote server by reading input file.

    so tar only included the files in the list.
    and its need to be create in a remote server.
    i'm using ./sh shell.

    sorry about the confusion.

    Inshaf

  7. #7
    Senior Member
    Join Date
    Aug 2011
    Posts
    453
    Thanks
    0
    Thanked 62 Times in 58 Posts
    Rep Power
    10

    Default

    IRC, it should something like this
    Code:
    tar xf - whereis/yourFile | ssh user@hostname 'cd wheryouwant; tar cfp -
    google gives it when you search a little.
    A problem clearly stated is a problem half solved.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy file from UNIX to Windows XP
    By inshaf.ccna in forum Shell scripting
    Replies: 5
    Last Post: 23rd April 2012, 11:56 AM
  2. Replies: 0
    Last Post: 7th February 2012, 01:00 PM
  3. [Solved] Linux / UNIX copy single file in to two files
    By kumarat9pm in forum CentOS / RHEL / Fedora
    Replies: 4
    Last Post: 30th April 2010, 12:11 PM
  4. [Solved] How to copy fonts file in UNIX / Linux?
    By tonjaa in forum Ubuntu / Debian
    Replies: 2
    Last Post: 12th July 2009, 06:14 PM
  5. Find Unix Linux File / Directory by date And Then Copy / Move File
    By asim.mcp in forum CentOS / RHEL / Fedora
    Replies: 1
    Last Post: 10th August 2008, 03:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •