Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6382777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:33:59+00:00 2026-05-25T02:33:59+00:00

I’m using bash shell. Hi,ppl Would be glad if someone could provide some kind

  • 0

I’m using bash shell.

Hi,ppl
Would be glad if someone could provide some kind of advice, because googling around yielded some answers
but couldn’t still get the script to work.

I’am new to using bash script and got a script to modify because it was failing to copy
a large number of files from and input directory to an output directory after the files were processed.

Description:

We have a bunch of pdf’s in a large directory.
We process a file called filename.pdf, after it’s processed an additional file is created called filename.pdf.marker
Then both files filename.pdf.marker and filename.pdf shoud be moved from input/in directory to directory output/out.
We work with about 10 -15 thousands of files.

The script should do the following:

  1. select all .marker file names
  2. move.marker files from input/in directory to directory output/out (done in separate line)
  3. remove the .marker from the selected filename,
  4. move the file filename.pdf to the output/out directory

Old script (didn’t work for a larger number of files) :

FILELIST=$(ls ${V04}/*.pdf.marker 2> /dev/null | sort)
for FILEMARKER in ${FILELIST}; do
    FILENAME=${V04}/$(basename $FILEMARKER .marker)
        mv ${FILENAME} ${VLOGDIR}/.  
        mv ${FILENAME}.marker ${VLOGDIR}/.  
    done  

Because of that I needed to use xargs command.

Problem:

I managed to move the .marker files in a separate line.
Now i need to move the .pdf files with this script line.

find /input/in -iname "*.marker" -print0 | xargs -0 -r -I {} mv `basename {} .marker`  /output/out

My problem lies in the part: `basename {} .marker`
Why isn’t the string filename.pdf extracted from the string filename.pdf.marker, and substituted into the mv command ?

Any help i’s welcome 😉

UPDATED

  • Corrected description of what script should do: Both filetypes .pdf
    and .pdf.marker should be moved in my script not copied.
  • Added old script that didn’t work well for larger amount of files.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:34:00+00:00Added an answer on May 25, 2026 at 2:34 am

    The problem with the old script was, that you try to catch all entries in one var, which have size limits.
    You can solve that, if you must not sort the entries in this way:

    ls -1 "${V04}/*.pdf,.marker | while read FM; 
    do 
        mv "${FM}" "${VLOGDIR}/"
        mv "${V04}/$(basename "${FM}" .marker)" "${VLOGDIR}/"
    done;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.