I have a directory named “MyDir”. I m using Ubuntu OS. And I have 7 files with various extensions. I want to write a Ruby Program to add a Timestamp to each of the file.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You’ll need to get a listing of all the files in the target directory (see
Dir.glob(...)) and then open the file for writing in “append mode” (seeFile.open(...)) and simply write in the timestamp. For example: