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

  • Home
  • SEARCH
  • 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 594911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:00:17+00:00 2026-05-13T16:00:17+00:00

I just wrote this backup script: #!/usr/bin/bash # the number of days to do

  • 0

I just wrote this backup script:

#!/usr/bin/bash

# the number of days to do the backup for.
days=5;

# the files to backup.
location[0]='/opt/aDirectory/'
location[1]='/extra/anotherDirectory/'

# the location to copy the file to
copyLocation='/users/JoeBlow/Backup/backup-'$(date | tr ' ' '-')

# Log stuff
mkdir $copyLocation
echo "made backup for last $days">>$copyLocation/log

for loc in ${location[*]}
do
        echo "made backup of $loc" >> $copyLocation/log
done

echo "Errors and Warnings from find and cp" >> $copyLocation/log

# preform the back up
for loc in ${location[*]}
do
        for toBack in `find $loc \! -name '*.class' -mtime -$days \! -type d -print 2>> $copyLocation/log`
        do
                temp=${copyLocation}$(dirname $toBack)
                mkdir -p $temp 2>> $copyLocation/log
                cp $toBack $temp 2>> $copyLocation/log
        done
done

But it is causing me grief.

When I was testing it I reached my disk quota. I thought no problem I will just rm -r the directory that I created, clear up some space and try again. Nope. Doesn’t work. I am getting this error;

% rm -r backup-Wed-Feb-10-16\:58\:59-EST-2010/
rm: Unable to remove directory backup-Wed-Feb-10-16:58:59-EST-2010//direcotry/something: File exists
....

Permissions problem right? Wrong.

I cd to the lowest place in that directory and there is one really big hidden file. So I rm it. It allows be to delete it but places a new file in the dir with a slightly different name. What is gong on?

Two questions:

1 Is there something wrong with my backup script?

2 Why can’t I delete that file?

  • 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-13T16:00:17+00:00Added an answer on May 13, 2026 at 4:00 pm

    Without more information, I’ll go out on a limb: your script is correct, if a little dangerous. It is trying to copy many files into your backup area, but gets stuck because there isn’t enough space. When you delete a big file, you free up enough space for it to copy in some more files. It can copy them in as fast as you can delete them.

    I suggest you kill the process, clear out the backup area, and put a space check in the script.

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

Sidebar

Related Questions

I just wrote a new web part and now I am getting this error
I just wrote this function to read a series of email addresses from a
Guys, I am very new to c++. I have just wrote this class: class
Just wrote a short script of copying all my tables into another local database.
I have just upgraded my server 2003 to serrver 2008. As I write this,
This code does not seem to compile, I just need to write something to
I just wrote my first web service so lets make the assumption that my
I just wrote the following C++ function to programmatically determine how much RAM a
I just wrote an if statement in the lines of if (value == value1
I have a macro that I wrote to just help me with my unit

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.