I want the list of all files given the folder name, i.e. it should traverse deep inside given the folder name ?
If I give any path like 'employee/app',it should list all files deep inside 'employee/app' folders
What about a nice typeglob:
p Dir['**/*']
Related
I'm trying to figure out how to perform the following steps within NiFi.
Obtain listing of directories from a specific location e.g. /my_src (Note the folders that will be appearing within here will be dated e.g. 20211125)
Based off of the listing obtained I need to sort the folders by date
For each folder then I need to GetFile from that directory
Then sort those files by their names
I am stuck at step 1 on finding a processor that pulls the directory names. I only see GetFile and List file.
Reason for this is that I need to process the folders based on the oldest to newest.
I would expect to be using a regex pattern to locate the valid folders that match the date format and ignore the other folders. Then with those values found pass them along sorted to another process that would get files from that path location, which GetFile does not seem to allow me to set dynamically.
Am I to approach this process differently within NiFi?
I have a folder that has around 400 subfolders each with ONE .jpeg file in them. I need to get all the pictures into 1 new folder using SSIS, everything is on my local (no connecting through different servers or DBs) just subfolders to one folder so that I can pull out those images without going one by one into each subfolder.
I would create 3 variables, all of type String. CurrentFile, FolderBase, FolderOutput.
FolderBase is going to be where we start searching i.e. C:\ssisdata
FolderOutput is where we are going to move any .jpg files that we find rooted under FolderBase.
Use a Foreach File Enumerator (sample How to import text files with the same name and schema but different directories into database?) configured to process subfolders looking for *.jpg. Map the first element on the Variable tab to be our CurrentFile. Map the Enumerator to start in FolderBase. For extra flexibility, create an additional variable to hold the file mask *.jpg.
Run the package. It should quickly zip through all the folders finding and doing nothing.
Drag and drop a file system task into the Foreach Enumerator. Make it a Move file (or maybe it's rename) type. Use a Variable source and destination. The Source will be CurrentFile and the destination will be FolderOutput
I'm having a bit of trouble with AppleScript...
Long story short - what I'm trying to do is to do a function for every folder of parrentFolder containing someFile.
Basicaly, I have a complex folder structure with multiple folders ending up with a couple of files, within which (sometimes) there's a 'Preview.png' file. Now what I'm trying to do is to run a function that will go over each and every folder and whenever it finds 'Preview.png' within a folder it should store folder's path after which I can run a function to change the icon of that folder to a 'Preview.png' image. And it should loop over all of the folders in the main folder.
Anyone able to give me a hand?
Thanks,
Marko
I want to iterate through every jpg/jpeg file in a directory and every subdirectory and every subdirectory of that sub-directory and so on. I want to be able to go through every single image file in a folder. Is there an easy way to do this or would a recursive method work best?
Dir.glob("your_directory/**/*.{jpg,jpeg}")
In my Rails application, I need to create a symlink between two files inside RAILS_ROOT. The names of target and symlink are given as absolute paths. However, I want to create a symlink that uses relative paths, so the application folder could easily be moved.
In other words, from RAILS_ROOT/path/foo/bar and RAILS_ROOT/path/baz I want to get ../../baz as an answer.
Is there a library function (or a simple one-liner) to do that?
Try the relative_path_from method of a Pathname.