Code to use in Ruby on Rails:
@files = Dir.glob("path-of-directory/*")
you can check whether any files are there or not ? by the below code,
@total_files = @files.size
Here, you will get all files and folders of the specified directory
If you want only files, then you can use below command,
@files = Dir.glob("path-of-directory/*.*")
Ok. now you can get files names by below code:
for file in @files
puts file
end
If you want random file name and it's extension from @files, then
file_name = @files[rand(999)%@files.size]
ext = file_name[file_name.index('.')+1, file_name.length]
Install / Upgrade to OpenSSH 6.6p on Ubuntu 12.04 and 13.10
-
Hey all, Had to upgrade OpenSSH to 6.6p for PCI Compliance. Found that
12.04 does not support OpenSSH 6.6p via direct upgrade. So Had to do it
manually. Af...
10 years ago