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 936445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:18:58+00:00 2026-05-15T21:18:58+00:00

I am writing the following script to copy *.nzb files to a folder to

  • 0

I am writing the following script to copy *.nzb files to a folder to queue them for Download.

I wrote the following script

#!/bin/bash

#This script copies NZB files from Downloads folder to HellaNZB queue folder.

${DOWN}="/home/user/Downloads/"
${QUEUE}="/home/user/.hellanzb/nzb/daemon.queue/"


for a in $(find ${DOWN}  -name  *.nzb)
do
cp ${a} ${QUEUE}
rm *.nzb
done

it gives me the following error saying:

HellaNZB.sh: line 5: =/home/user/Downloads/: No such file or directory
HellaNZB.sh: line 6: =/home/user/.hellanzb/nzb/daemon.queue/: No such file or directory

Thing is that those directories exsist, I do have right to access them.

Any help would be nice.

Please and thank you.

  • 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-15T21:18:59+00:00Added an answer on May 15, 2026 at 9:18 pm

    Variable names on the left side of an assignment should be bare.

    foo="something"
    echo "$foo"
    

    Here are some more improvements to your script:

    #!/bin/bash
    
    #This script copies NZB files from Downloads folder to HellaNZB queue folder.
    
    down="/home/myusuf3/Downloads/"
    queue="/home/myusuf3/.hellanzb/nzb/daemon.queue/"
    
    find "${down}" -name "*.nzb" | while read -r file
    do
        mv "${file}" "${queue}"
    done
    

    Using while instead of for and quoting variables that contain filenames protects against filenames that contain spaces from being interpreted as more than one filename. Removing the rm keeps it from repeatedly producing errors and failing to copy any but the first file. The file glob for -name needs to be quoted. Habitually using lowercase variable names reduces the chances of name collisions with shell variables.

    If all your files are in one directory (and not in multiple subdirectories) your whole script could be reduced to the following, by the way:

    mv /home/myusuf3/Downloads/*.nzb /home/myusuf3/.hellanzb/nzb/daemon.queue/
    

    If you do have files in multiple subdirectories:

    find /home/myusuf3/Downloads/ -name "*.nzb" -exec mv {} /home/myusuf3/.hellanzb/nzb/daemon.queue/ +
    

    As you can see, there’s no need for a loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I bumped into the following problem: I'm writing a Linux bash script which does
I'm writing a bash script to add, commit, push all files in a directory.
I am writing simple housekeeping script. this script contains following line of codes.This is
I am writing a custom .pac script for use with Firefox. Following numerous examples
I am writing the following script up import a csv file into a mysql
I got the following script for loading about hundred thousand .doc files and ran
I'm writing a script that looks for certain files in a directory and processes
Thanks for your help in advance. I'm writing a simple bash script, which just
i'm currently writing a linux script that has the following code: echo \nCompiled on:\n
I'm writing a BASH script to integrate our company's custom intranet with our postfix

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.