Tosca - Buffer first filename in a directory - automation

Just wanted to know how to buffer the filename of the first file in a given directory in Tosca

Related

Cant unzip file because of multiple files with same name in zip file in react-native

I have been successfully unzipping zip files using react-native-zip-archive in react-native. But this time around the package fails to unzip the file because of existence of multiple files with same name in the zip file.
A Zip file can indeed contain multiple files with the same name.
It's up to you to decide what to do in your program for this case when extracting them - and more generally, files that are already existing on the target system.

VBA-How to convert a local path of a file in a folder managed by Drive File Stream into an URL

My goal is to create an xls sheet containing a list of files (file name + link to the file) contained in a folder.
This folder is a GDrive synchronized folder (using Drive File Stream)
I have a VBA macro which is producing this list of files but the link is a local link (G:...) and not an URL link (https://drive.google.com/...) that can be used outside my computer.
Here is an exemple
Let say I have a file in my "Drive File Stream" folder like this one:
G:\Team Drives\Test\my_file.txt
How to convert this path (using excel vba) into a GDrive's URL:
https://drive.google.com/file/d/FILE_ID/edit?usp=sharing
Another way to ask is how to get the file_id from a local path?

How to tell to gsutil file upload command that the "dst_url" is actually a file, not a directory?

On a GCS bucket, I have uploaded from the web console a file with name fileName, and created a directory with the same fileName name. Hence, the GCS bucket contains both at its root a file with name fileName and a directory with the same name.
Now, when I attempt to update the fileName file via the gsutil command via
gsutil cp localFile gs://bucketname/fileName
where localFileis a file on my local machine and gs://bucketname/fileName is hence the dest_url parameter, instead of overriding the GCS fileName file, a new file with name fileName is created in the GCS directory with name fileName, which yields the GCS file gs://bucketname/fileName/fileName.
I could not find an option in the gsutil command, which indicates that the provided dest_url should be interpreted as a file and not a directory.
Did I miss something? Any work-around, please?
A workaround to accomplish this is to use:
gsutil rsync -d . gs://bucketname
This command will keep the contents of filename directory but will change the contents of filename file; as a matter of fact, this command synchronizes the contents of your local path (in this case the "current" path specified by "dot": .) with the contents of your bucket, therefore, if you just change the contents of filename file in your local system, the synchronization will result in an "overwriting" of your filename file in your GCS bucket without affecting your filename directory.

unable to open text file

I'm trying to get a program to open a file and read from it. However, I can't seem to get it to open the file. I've read several threads about this and I've seen the suggestion to make sure the file is in the same directory as my executable. I don't know how to check if that's true. The text file is saved in the same file as my program files, if that helps. Can anyone give me some input? Relevant code below. Thanks!
std::ifstream myfile;
myfile.open("../ResInput.txt", ios::in);
if(myfile.is_open()){
getline(myfile, stemp1);...
Your open() call is trying to go up one directory to read the file as it's written right now. If you want the file opened in the same directory as your executable, remove the ../ in your open() call.
This is also assuming your OS accepts a forward slash as a directory separator. It would also be useful to know the error you are getting.

replacing content from cache to document directory?

In my Document folder i am having a folder named folder1 in that folder i am having css,js,main.html etc.. i am opening the main.html in webview....If any updates are done in server i am downloading folder2 and unzipping it in cache directory For example: i am having css,js ,main.html in folder1 in document directory and a new update is done in server and i am downloading folder2 and unzipping in cache directory in folder2 i am having css only now i want to compare these folder1 and folder2 content if equal means in this example css is present in both the folders i want to delete css in document directory folder1 and i want to replace the css which is in folder2 to folder1...this is the process next time if any update is done then i may download js not css at that time i want to replace only js.can any one help how to check the content and replace ... please help me its imp to me
As per my understanding, you are using Documents directory to store the CSS and HTML to be loaded inside UIWebView and Caches directory to unzip and store latest CSS and HTML files from the server. After unzipping, you want to compare the contents of CSS and JS files in Caches folder with the contents of CSS and JS files in Documents folder and replace if they have changed.
There are 2 steps in this:
Standardizing files names across both folders so that you know which file from Caches directory should be compared with which file from Documents directory. Give the same names to files that are to be compared.
On fetching the file from server and unzipping in Caches folder, you can get use NSFileManager class to access the same file (names are same as mentioned in point 1) in your Documents directory and then read it in an NSString and then compare that with another NSString that contains your Caches folder content. If the comparison returns equal you can skip. Else, you can use
NSFileManager *manager = [NSFileManager defaultManager];
[manager copyItemAtPath:sourcePath(CachesDir) toPath:destinationPath(DocumentsDir) error:&error]
This will copy your latest unzipped item from CacheDirectory to Documents Directory.
However, you may want to double check saving content in Documents Directory as it is backed-up on iCloud account to which the device is mapped. Please read about this further.