08-26-2010
Move files & folder structure
Hey, this might be a really basic question, but I'm new to Unix scripting.
I'm trying to find a command to replicate a file structure from one location to another & move the actual files contained in the base directories, i.e. I have this structure -
home/temp/test/dir1/
File1.txt
File2.txt
File3.txt
/dir2/
File4.txt
File5.txt
/home/temp/work/
/home/temp/complete/
I want to replicate the file structure under 'home/temp/test/' in 'home/temp/work/' & 'home/temp/complete/', then move the files into the new file structure, so after running the script I want to have this structure -
home/temp/test/dir1/
/dir2/
/home/temp/work/dir1/
File1.txt
File2.txt
File3.txt
/dir2/
File4.txt
File5.txt
/home/temp/complete/dir1/
File1.txt
File2.txt
File3.txt
/dir2/
File4.txt
File5.txt
I hope that's clear, thanks for any help!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi:
I have some files like this
folder1/recording1.mp3
folder1/docs/budget.doc
folder2/others/misc.mp3
folder3/others/notes.doc
all this folders and files are under the mp3 folder.
I would like to move just the mp3s to another folder but retain the subdir structure i have.
So if... (4 Replies)
Discussion started by: jason7
4 Replies
2. Shell Programming and Scripting
This is the file structure:
DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg
DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg
DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg
DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg
DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies
3. Shell Programming and Scripting
Hi all,
Hello everyone, my first post here :). I tried to search the forum but I didn't find exactly what I was looking for...
I need to zip/tar files across entire filesystem which are more 3+ years old but leave folder structure intact. If the script locates tar/zip files they are more... (1 Reply)
Discussion started by: sashruby
1 Replies
4. Linux
Hi Team,
I have over 1 lakh pdf files.
I want to create folders like Disk-1, Disk-2 ..... & want to move 3000 pdfs per folder. Can i do it by script? Please help me.
Thanks & Regards
Parag Nehete (4 Replies)
Discussion started by: paragnehete
4 Replies
5. Shell Programming and Scripting
Hi,
I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location.
Ex:
mainfolder1
file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure.
rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies
6. Shell Programming and Scripting
I want to move a folder with spaces from one folder to another.
I have two folders like this,
1).RT_032-222 -4444-01/ 2). RT_032-555 -7777-01/
I want to move files from 2 to 1 through shell script.Here I want to assign this like a user defined variable like as Source branch... (2 Replies)
Discussion started by: kannansoft1985
2 Replies
7. Shell Programming and Scripting
Hello,
I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure.
for example:
/XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt
I know about find /XYZ -type f -mtime +14... (3 Replies)
Discussion started by: prvnrk
3 Replies
8. Shell Programming and Scripting
The below will move all the files in the directory dir to the destination using parallel and create a log, however will not keep them in the directory. I have tried mkdir -p but that does not seem to work or at least I can not seem to get it (as it deletes others files when I use it). What is the... (2 Replies)
Discussion started by: cmccabe
2 Replies
9. Shell Programming and Scripting
We are receiving few zipped files in one location say : apple/oranges/incoming
All .zip files are placed here in incoming folder.
So few of the files are password encrypted.
There are only 10 zipped files, so we are planning to create a script which will pick that zip file from incoming... (1 Reply)
Discussion started by: Sidhant
1 Replies
10. Shell Programming and Scripting
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
LEARN ABOUT CENTOS
data::dumpxml
DumpXML(3pm) User Contributed Perl Documentation DumpXML(3pm)
NAME
Data::DumpXML - Dump arbitrary data structures as XML
SYNOPSIS
use Data::DumpXML qw(dump_xml);
$xml = dump_xml(@list)
DESCRIPTION
This module provides a single function called dump_xml() that takes a list of Perl values as its argument and produces a string as its
result. The string returned is an XML document that represents any Perl data structures passed to the function. Reference loops are han-
dled correctly.
The following data model is used:
data : scalar*
scalar = undef | str | ref | alias
ref : scalar | array | hash | glob | code
array: scalar*
hash: (key scalar)*
The distribution comes with an XML schema and a DTD that more formally describe this structure.
As an example of the XML documents produced, the following call:
$a = bless [1,2], "Foo";
dump_xml($a);
produces:
<?xml version="1.0" encoding="US-ASCII"?>
<data xmlns="http://www.cpan.org/.../Data-DumpXML.xsd">
<ref>
<array class="Foo">
<str>1</str>
<str>2</str>
</array>
</ref>
</data>
If dump_xml() is called in a void context, then the dump is printed on STDERR automatically. For compatibility with "Data::Dump", there is
also an alias for dump_xml() called simply dump().
"Data::DumpXML::Parser" is a class that can restore data structures dumped by dump_xml().
Configuration variables
The generated XML is influenced by a set of configuration variables. If you modify them, then it is a good idea to localize the effect.
For example:
sub my_dump_xml {
local $Data::DumpXML::INDENT = "";
local $Data::DumpXML::XML_DECL = 0;
local $Data::DumpXML::DTD_LOCATION = "";
local $Data::DumpXML::NS_PREFIX = "dumpxml";
return dump_xml(@_);
}
The variables are:
$Data::DumpXML::INDENT
You can set the variable $Data::DumpXML::INDENT to control the amount of indenting. The variable contains the whitespace you want to
be used for each level of indenting. The default is a single space. To suppress indenting, set it to "".
$Data::DumpXML::INDENT_STYLE
This variable controls where end element are placed. If you set this variable to the value "Lisp" then end tags are not prefixed by
NL. This give a more compact output.
$Data::DumpXML::XML_DECL
This boolean variable controls whether an XML declaration should be prefixed to the output. The XML declaration is the <?xml ...?>
thingy. The default is 1. Set this value to 0 to suppress the declaration.
$Data::DumpXML::NAMESPACE
This variable contains the namespace used for the XML elements. The default is to let this be a URI that actually resolve to the XML
schema on CPAN. Set it to "" to disable use of namespaces.
$Data::DumpXML::NS_PREFIX
This variable contains the namespace prefix to use on the elements. The default is "", which means that a default namespace will be
declared.
$Data::DumpXML::SCHEMA_LOCATION
This variable contains the location of the XML schema. If this variable is non-empty, then an "xsi:schemaLocation" attribute is added
to the top level "data" element. The default is not to include this, as the location can be inferred from the default XML namespace
used.
$Data::DumpXML::DTD_LOCATION
This variable contains the location of the DTD. If this variable is non-empty, then a <!DOCTYPE ...> is included in the output. The
default is to point to the DTD on CPAN. Set it to "" to suppress the <!DOCTYPE ...> line.
BUGS
Class names with 8-bit characters are dumped as Latin-1, but converted to UTF-8 when restored by the Data::DumpXML::Parser.
The content of globs and subroutines are not dumped. They are restored as the strings "** glob **" and "** code **".
LVALUE and IO objects are not dumped at all. They simply disappear from the restored data structure.
SEE ALSO
Data::DumpXML::Parser, XML::Parser, XML::Dumper, Data::Dump
AUTHORS
The "Data::DumpXML" module is written by Gisle Aas <gisle@aas.no>, based on "Data::Dump".
The "Data::Dump" module was written by Gisle Aas, based on "Data::Dumper" by Gurusamy Sarathy <gsar@umich.edu>.
Copyright 1998-2003 Gisle Aas.
Copyright 1996-1998 Gurusamy Sarathy.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.8.8 2006-04-08 DumpXML(3pm)