Sponsored Content
Top Forums Shell Programming and Scripting copy folder and its contents to another folder Post 302651823 by amvarma77 on Wednesday 6th of June 2012 08:18:48 AM
Old 06-06-2012
copy folder and its contents to another folder

Hi experts,

I am coming to you with this basic question on copying a folder and its content from one location to another folder using PERL script.

This is my requirement.

I have a folder AB under /users/myhome
I want to copy AB and its contents to /user/workspace.
Finally it should look like, /users/workspace/AB

How to do it using perl?

This is my code but its not working correctly as I don't see AB under /user/workspace, instead only contents of AB.

Code:
#!/usr/bin/perl 
#!/usr/bin/env perl -w
use strict;
use warnings;
use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
dircopy("/users/myhome/AB","/users/workspace/") or die("$!\n");

Please help
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Folder Contents

Hi, I'm trying to allow people to access the contents of a folder on a web site, I am automatically placing files in this folder for people to download. I'm using Apache on Mac OS X, if that makes a difference. Can anyone help with this? I've found no documentation on this so far... ... (6 Replies)
Discussion started by: spencer
6 Replies

2. UNIX for Dummies Questions & Answers

copy folder contents

I need to make a new dir in side the dir lab5 the new dir is called testLab5 without changing directories copy all files from your lab5 directory into your testLab5 directory then i have to without chaning directories and using exactly one command remove all files that start with the... (1 Reply)
Discussion started by: robsk8_99
1 Replies

3. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

4. UNIX and Linux Applications

Copy folder and its contents from HP Unix server to RH Linux

I am trying to copy a folder and all its contents from HP Unix box to RH linux, using the following. rsync -avz -e "ssh" /users/www/webroot/docFiles/Division/Ctry ftpuser@10.4.xxx.yz:/data/webroot/development/contentfiles/webroot/docFiles/Division/Ctry/QAfiles And it throws a consistent... (2 Replies)
Discussion started by: FanTom
2 Replies

5. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

6. Shell Programming and Scripting

How to copy all the contents of a list of files present in a folder to a particular file?

Hi All, I want to copy all the contents of a list of files in a folder to a particular file. i am using following command: cat dir/* >> newFile.txtIt's not working. Could you please help? Thanks, Pranav (3 Replies)
Discussion started by: Pranav Bhasker
3 Replies

7. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

How to copy files with the same filenames as those in another folder to that same folder?

Hello All A similar question like this was asked before but I need to change part of the question. I've two folders, Folder A contains some image files in 150 subfolders; Folder B contains text files in 350 subfolders. All image files in Folder A have the same filename as the text... (5 Replies)
Discussion started by: chlade
5 Replies

9. Shell Programming and Scripting

Remove folder contents

for dir in BKP/*/ do echo You are in :$dir done O/P -- BKP/201448/ BKP/201449/ BKP/201450/ BKP/201451/ BKP/201452/ BKP/201501/ BKP/201502/ BKP/201503/ BKP/201504/ BKP/201505/ BKP/201506/ BKP/201507/ (3 Replies)
Discussion started by: rocking77
3 Replies

10. UNIX for Beginners Questions & Answers

Best way to move the contents of a folder to another one

what is the best way to move the contents of a folder to another one without deleting the structure of the first one. the contents could include subfolder too. both folder, the source-folder and the target-folder are on the same host. any idea is appreciated . (7 Replies)
Discussion started by: andy2000
7 Replies
DtWsmSetWorkspaceTitle(API)											       DtWsmSetWorkspaceTitle(API)

NAME
DtWsmSetWorkspaceTitle -- set workspace title SYNOPSIS
#include <Dt/Wsm.h> int DtWsmSetWorkspaceTitle( Widget widget, Atom workspace, char *title); DESCRIPTION
The DtWsmSetWorkspaceTitle() function works with the CDE workspace manager, dtwm(1), and changes a specific workspace's title. Applications can use this function to implement an interface to the workspace manager. If the DtWsmSetWorkspaceTitle() function is not successful, the most likely reason for failure is that the CDE workspace manager, dtwm(1), is not running. The DtWsmSetWorkspaceTitle() function requires a widget. A gadget (or unrealized widget) is not acceptable for the widget argument. DtWsmSetWorkspaceTitle() sends a message to the CDE workspace manager, dtwm(1), to set the title. If the workspace name is not valid, no action is taken and the workspace manager reports no error. ARGUMENTS
widget A realized widget on the screen of interest workspace The name of the workspace (in X atom form) where the title should be set title The new title RETURN VALUE
The function returns Success (0) when it succeeds, and non-zero upon failure. Note that these are not the same values that _DtWsmSet- WorkspaceTitle returns. SEE ALSO
DtWsm(5) "Communicating with the Workspace Manager" section in the CDE Programmer's Guide "Workspace Manager" section in the CDE Programmer's Overview DtWsmSetWorkspaceTitle(API)
All times are GMT -4. The time now is 05:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy