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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:25:42+00:00 2026-06-17T03:25:42+00:00

Suppose I have an Excel sheet, which has the some numbers say: 77787 45877

  • 0

Suppose I have an Excel sheet, which has the some numbers say:

  • 77787
  • 45877
  • 78985 so on…

Now I have an directory called as “D://Filehosting” in windows 7 machine. under that directory I have some 500 folders, each of them having 120 files in it. Now I want to delete the contents of each folder which which are 2 months older from the current date. Now the folders are arranged something like below:

  • D://Filehosting/Document77787
  • D://Filehosting/Document45877 .. so on

Script should take the numbers as mentioned above, and accordingly find the right directory and accordingly delete the contents.Must check if the if the folder exists or not before content deletion approach.

Can it be done using Ruby?

  • 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-06-17T03:25:43+00:00Added an answer on June 17, 2026 at 3:25 am
      def del_dir id
        Dir["D:/Filehosting/Document#{id}/*"].each do |fname|
          next unless File.file?(fname)                # skip accident dirs
          if Time.now-File.mtime(fname) > 2*30*24*3600 # nearly 2 months
            puts "[!] will delete #{fname}, mtime=#{File.mtime(fname)}"
            # File.unlink(fname)                       # uncomment this to actually delete
          end
        end
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have Sheet(1) in an excel. Now i do also have 2500 rows
I have some strings in Java (originally from an Excel sheet) that I presume
Suppose I have a column called item code as below: ----- ------ |row| |code|
I have a number of single sheet Excel files and I'd like to create
Suppose i have the following raw data in excel spreadsheet: [Name ] [ID ]
Suppose, in Excel, I have a formula =$C$8+1 , what must I add to
I have an excel sheet with values in columns A, B and C like
So I have this Excel workbook which basically is supposed to be a data
Suppose I have a function attached to one of my Excel sheets: Public Function
Suppose I have typed excel.exe /r c:\book1.xlsx in the Run Window . How will

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.