Sponsored Content
Top Forums Shell Programming and Scripting Copying files to new dir structure. Post 302644889 by arcanas on Tuesday 22nd of May 2012 02:51:21 PM
Old 05-22-2012
Copying files to new dir structure.

I am trying to figure out a way to script copying specific files from one dir structure to another.

I have a dir structure like this:
Code:
dira/author 1/book 1/file a.epub
             /book 2/file b.epub
    /author 2/book 1/file c.epub
    /author 3/book 1/file d.epub
             /book 2/file e.epub
             /book 3/file f.epub
<etc....>

The result I am looking for is:
Code:
dirb/author 1/file a.epub
             /file b.epub
    /author 2/file c.epub
    /author 3/file d.epub
             /file e.epub
             /file f.epub
<etc....>

Currently I just use a quick script to cp the files up one level in the "dira" file structure, dupe it to "dirb" and then clean it up manually:
Code:
find . -type f -name "*.epub" |while read file
do
        cp "$file" "${file%/*}"/../
done

I could do something like this to create the new dir structure:
Code:
find . -type f -name "*.epub" -printf "%P\n" > $books
cd dir2
awk -F / '{ print $2 }' $books | xargs $DEBUG mkdir -p

but I am stumped on copying the files into that structure. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copying files to new dir

Hello, I'm new to shell scripting so I don't really understand what I'm doing wrong. The script I'm trying to do saves all the files (*.c) on the current dir to a list and, one by one, copies them to a new one called Backup. The thing is, if there are already other versions of the files I'm... (6 Replies)
Discussion started by: G3nn
6 Replies

2. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies

3. Shell Programming and Scripting

Script to run a command on all txt files present in a dir structure

Hi, I have a directory structure like the one given below root\a\b1 root\a\b2 root\b\b1 root\b\b2 . . . root\j\b1 root\j\b2 Now, there are a txt files in each dir and subdir, there is a root.txt I have to write a script where in i have to run a command called "genrb <filename>"... (6 Replies)
Discussion started by: vikramsinghnegi
6 Replies

4. Shell Programming and Scripting

Copying a directory structure with the latest versions of files

Hello I have three directory structures for code releases. Each directory structure looks like this: bash-3.00$ ls -R | more .: Test_Release_1 Test_Release_2 Test_Release_3 ./Test_Release_1/dbcode: rp_online_import_srdp.pkb-1 srdp_ar_validation.pkb-1... (1 Reply)
Discussion started by: Glyn_Mo
1 Replies

5. Shell Programming and Scripting

Copying specific files from one dir to another

Hi Folks, I have one curious case. There are list of following files placed in one directory such as... And updated each month. files.JAN09.csv files.FEB09.csv files.MAR09.csv ..... Now, I need to move a specific files; i.e, For this month, I need to move only OCT09, NOV09, DEC09,... (1 Reply)
Discussion started by: Jerald Nathan
1 Replies

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

7. UNIX for Dummies Questions & Answers

copying the dir/subdir structure from one server to another?

Hi All, I want to copy the dir/subdir structure from SERVER-A to SERVER-B without copying all the files in each dir. Is it possible using SCP / SFTP command? For example, SERVER-A has following two dir/subdirectories and files under each subdir. ... (1 Reply)
Discussion started by: Hangman2
1 Replies

8. Shell Programming and Scripting

Issue with copying files into dir inside for loop

Hi , I'm trying to move/copy the files inside the loop into a directory . I tried the below code and the issue is the data is not copying into the created directory but the files are copying into another file file_path="/home/etc" Last_Day=20130930 mkdir $file_path/ARC_${Last_Day} ... (3 Replies)
Discussion started by: smile689
3 Replies

9. Shell Programming and Scripting

PERL - Copying ONLY files from one dir to another

I'm writing a Perl script which has its 1st step as to copy files from one directory to another directory. The Source directory has got files with extension, without extension, directories etc. But I want to copy ONLY files with no extension. The files with extensions and directories should not get... (2 Replies)
Discussion started by: jhamaks
2 Replies

10. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

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
PUBLICAN(1p)						User Contributed Perl Documentation					      PUBLICAN(1p)

NAME
publican - a DocBook XML publishing tool. VERSION
This document describes publican version 1.0 SYNOPSIS
publican <command options> publican <action> <action options> Command Options --help Display help message --man Display the man page --help_actions Display a list of valid actions -v Display the version of Publican Valid actions are: build Transform XML to other formats (pdf, html, html-single, etc) bump TECH PREVIEW: bump the pubsnumber [revision]. This feature is intended to have an additional argument to add a revision history entry and message. This feature is UNTESTED clean Remove all temporary files and directories clean_ids Run clean ids for source XML clean_set Remove local copies of remote set books create Create a new book, set, or article create_brand Create a new brand create_site Create a new WebSite in the supplied location. help_config Display help text for the configuration file install_book Install a book in to a WebSite. install_brand Install a brand to the supplied location lang_stats report PO statistics old2new Create a publican.cfg file from the Makefile of an old book, set, or article package Package a language for shipping print_banned Print a list of banned DocBook tags print_known Print a list of QA'd DocBook tags print_tree Print a tree of the xi:includes print_unused Print a list of unused XML files remove_book Remove a book from a WebSite. rename Rename a publican book site_stats Report on the contents of a WebSite update_db Add or remove database entries. Used for processing pre-build books, such as when building packages. update_po Update the PO files update_pot Update the POT files update_site Update an existing sites templates. Run: 'publican <action> --help' for details on action usage DESCRIPTION
Publican is a DocBook publication system, not just a DocBook processing tool. As well as ensuring your DocBook XML is valid, publican works to ensure your XML is up to publishable standard. INTERFACE
build Transform XML to other formats (pdf, html, html-single, etc) Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --formats=<FORMATS> Comma-separated list of formats, for example: html,pdf,html-single,html-desktop,txt,epub --langs=<LANGS> Comma-separated list of languages, for example: en-US,de-DE,all --publish Set up built content for publishing --embedtoc Embed the web site TOC object in the generated HTML --distributed_set This flag tells publican the data being processed is a distributed set. Note: do not use distributed_set on the command line. Publican uses this flag when calling itself to process distributed sets. This is the only safe way this flag can be used. --novalid Do not run the DTD validation bump TECH PREVIEW: bump the pubsnumber [revision]. This feature is intended to have an additional argument to add a revision history entry and message. This feature is UNTESTED Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --lang=<LANG> The language the XML will be written in clean Remove all temporary files and directories Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. clean_ids Run clean ids for source XML Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. clean_set Remove local copies of remote set books Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. create Create a new book, set, or article Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --name=<NAME> The name of the book, article, set, or brand --version=<VERSION> The version of the product --edition=<EDITION> The edition of the book, article, or set --product=<PRODUCT> The name of the product --brand=<BRAND> The brand to use --lang=<LANG> The language the XML will be written in --type=<TYPE> The type (book, article, or set) create_brand Create a new brand Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --name=<NAME> The name of the book, article, set, or brand --lang=<LANG> The language the XML will be written in create_site Create a new WebSite in the supplied location. Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. --db_file=<DB_FILE> Override default database file. --toc_path=<TOC_PATH> Override the default TOC path. --tmpl_path=<TMPL_PATH> Override the default template path. --lang=<LANG> The language the XML will be written in help_config Display help text for the configuration file Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. install_book Install a book in to a WebSite. Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. --lang=<LANG> The language the XML will be written in install_brand Install a brand to the supplied location Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --path=<PATH> /path/to/install/to lang_stats report PO statistics Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --lang=<LANG> The language the XML will be written in old2new Create a publican.cfg file from the Makefile of an old book, set, or article Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. package Package a language for shipping Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --lang=<LANG> The language the XML will be written in --desktop Create desktop instead of web package --brew Push SRPM to brew --scratch Use scratch instead of tag build --short_sighted Create package without using version in package name --binary Build binary rpm when running package --wait Wait for brew to finish building --cvs Import the SRPM in to CVS, the run make tag and make build. print_banned Print a list of banned DocBook tags Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. print_known Print a list of QA'd DocBook tags Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. print_tree Print a tree of the xi:includes Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. print_unused Print a list of unused XML files Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. remove_book Remove a book from a WebSite. Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. --lang=<LANG> The language the XML will be written in rename Rename a publican book Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --name=<NAME> The name of the book, article, set, or brand --product=<PRODUCT> The name of the product --version=<VERSION> The version of the product site_stats Report on the contents of a WebSite Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. update_db Add or remove database entries. Used for processing pre-build books, such as when building packages. Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. --add Add a database entry --del Delete a database entry --lang=<LANG> The language the XML will be written in --product=<PRODUCT> The name of the product --version=<VERSION> The version of the product --name=<NAME> The name of the book, article, set, or brand --formats=<FORMATS> Comma-separated list of formats, for example: html,pdf,html-single,html-desktop,txt,epub --subtitle=<SUBTITLE> Sub title for a book --abstract=<ABSTRACT> Abstract for a book --product_label=<PRODUCT_LABEL> product label for a book --version_label=<VERSION_LABEL> version label for a book --name_label=<NAME_LABEL> name label for a book update_po Update the PO files Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --langs=<LANGS> Comma-separated list of languages, for example: en-US,de-DE,all update_pot Update the POT files Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. update_site Update an existing sites templates. Options: --help Display help message --config=s Use a nonstandard config file --common_config=s Override path to Common_Config directory --common_content=s Override path to Common_Content directory --nocolours Disable ANSI colourisation of logging. --quiet Disable all logging. --site_config=<SITE_CONFIG> WebSite configuration file to use or create. CONFIGURATION AND ENVIRONMENT
Publican requires access to GetText msgmerge for merging updated POT files with PO files. Publican requires access to Apache FOP for creating PDF files. DEPENDENCIES
Archive::Tar Carp Config::Simple Cwd DateTime DateTime::Format::DateParse Encode File::Copy::Recursive File::Find File::Find::Rule File::Path File::pushd File::Spec Getopt::Long HTML::FormatText HTML::TreeBuilder I18N::LangTags::List Image::Magick Image::Size Locale::PO Makefile::Parser Module::Build Pod::Usage Publican Publican::Builder Publican::CreateBook Publican::CreateBrand Publican::Localise Publican::Translate Publican::TreeView Publican::XmlClean Syntax::Highlight::Engine::Kate Term::ANSIColor Test::More Text::Wrap XML::LibXML XML::LibXSLT XML::TreeBuilder INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "publican-list@redhat.com", or through the web interface at <https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Publican&amp;component=publican>. AUTHOR
Jeff Fearn "<jfearn@redhat.com>" perl v5.14.2 2012-06-18 PUBLICAN(1p)
All times are GMT -4. The time now is 08:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy