Rename a «grandparent» folder case-sensitive? - vb.net

How can I rename the folder called «grandparent» in the following directory structure
C:\Temp\grandparent\parent\child\
to «GrandParent» and
C:\Temp\GrandParent\parent\child\
The child-folder is not empty and contains different files.
If I try it with the command IO.Directory.Move(OldDirName, NewDirName) I get an error that the directory name must not be identical (ignoring the different case spelling).
Do I really have to move it to a completely new temporary directory (like C:\AnotherTemp\ and then move it back to the desired «GrandParent»?
(This answer seems only to work, if the last part («child») should be renamed.)

Related

How to get all files and folders recursively using GetMetadata activity

I need to delete many folders with an exempt list which has a list of folders and files that I should not delete. So I tried delete activity and tried to use if function of Add dynamic content to check whether the file or folder name is the same of the specified ones. But I do not have what should be the parameters #if(). In other words, to use these functions, how do we get the file name or folder name?
It is difficult to get all files and folders by using GetMetadata activity.
As workarounds, you can try these ways:
1.create a Delete activity and select List of files option. Then create a file filled with those path of files and folders need to be deleted.(relative path to the path configured in the dataset).
2.using blob SDK to do this thing.

Is there a common strategy for renaming files from various locations in same folder?

For example, I have files named "a" from locations a and b and I put them together into same folder. Is there some best practice, how to rename those duplicates so the old name remains distinguishable?
The content of those files is downloaded via libcurl from various URLs, so I have the host-names of those files, but there can be the same file-name on same host with different path and I know the paths of those files, but the paths can be too long to be stored in a file-name.
I also have Adler-32 hashes of those files, but there can be a file with the same content with the same name, so putting the hash into the file-name would result into new duplicates.
So I want to store the original file-name into new file-name to not lose the original name, but add something to not overwrite the older files. I am not satisfied with Windows systems appending " - copy", because you end up getting file-names like "a - copy - copy", I am not satisfied with Ubuntu appending " (copy)"/" (another copy)"/" (3rd copy)"/" (4th copy)"/...
Maybe just adding number of instance of file-name would be fine, but putting the number at the beginning of the file-name breaks file-name sorting and putting it at the end changes the extension if there wasn't any like "a" => "a.0".

How to access two different routines in two files in Trace32 CMM scripts

I have two files in two different floder locations in Trace32. I execute cd.do file_name subroutine_name in Trace32. The trace32 takes the location of first command executed as the folder from which the following commands needs to be executed. How can I execute the routines from two different folders.
There is a pretty good guide here on how to script in Trace32.
http://www2.lauterbach.com/pdf/practice_user.pdf
I do not understand why you need to have them in two different folders, shouldn't it be solved by just have it in the same folder?
Well, maybe you should simply use DO <myscript.cmm> instead of CD.DO <myscript.cmm>.
DO <myscript.cmm> executes the script at the given location but keeps the current working path.
CD.DO <myscript.cmm> changes the working path to the location of the given script and then executes the script.
However I would recommend to write your scripts in a way that it doesn't matter if they are called with CD.DO or just DO. You can achieve that with either absolute paths or with paths relative to the script locations. (I prefer the 2nd one.)
So imagine the following file structure:
C:\t32\myscripts\start.cmm
C:\t32\myscripts\folder1\routines.cmm
C:\t32\myscripts\folder2\loadapp.cmm
C:\t32\myscripts\folder2\application.elf
You can cope this structure with absolute paths like that:
start.cmm:
DO "C:/t32/myscripts/folder1/routines.cmm" subroutine_A
DO "C:/t32/myscripts/folder2/loadapp.cmm"
folder2/loadapp.cmm:
Data.LOAD.Elf "C:/t32/myscripts/folder2/application.elf"
DO "C:/t32/myscripts/folder1/routines.cmm" subroutine_B
With relative paths you could use the prefix "~~~~" before accessing other files relative from the location of the currently executed PRACTICE script. The "~~~~" is replaced with the path of the currently executed script (just like "~" stands for your home directory.) There is also a function OS.PPD() which gives you the directory of the currently executed PRACTICE script.
So above situation with relative paths look like that:
start.cmm:
DO "~~~~/folder1/routines.cmm subroutine_A"
DO "~~~~/folder2/loadapp.cmm"
folder2/loadapp.cmm:
Data.LOAD.Elf "~~~~/application.elf"
DO "~~~~/../folder1/routines.cmm" subroutine_B

BigQuery loading batch folders error

I'm trying to load group of folders files in one time with when
i set
sourceURI = 'gs://ybbi/bi_landing_zone/files_to_load/app/reports/app_network_analytics_report/201409011*'
all the folders that i'm want to load start with 20140911
but i get the error:
ERROR: Invalid path: gs://ybbi/bi_landing_zone/files_to_load/apn/reports/appnexus_network_analytics_report/20140901191111_3bab8ec0_092a_43de_a157_db35d1555ea0/
20140901191111_3bab8ec0_092a_43de_a157_db35d1555ea0 is one of these folders(don't know why it's print the all folder name of this specific folder)
in some other folder tree cases it's works, but in this specific folder tree it's return the same error .
i know that cloud storage don't have real folders and it's part of the name of the object, but you understand what i mean.
is it bug?
Without more information, what it looks like is that you have a object file called gs://ybbi/bi_landing_zone/files_to_load/apn/reports/appnexus_network_analytics_report/20140901191111_3bab8ec0_092a_43de_a157_db35d1555ea0/ that is not a csv/json file. Some tools may create these dummy files in order to simulate directories. BigQuery requires all objects that match the input glob path to be importable files.
One solution would be to change the glob path to include a narrower set of files. You can pass multiple paths if that makes things easier. For example, you could pass
gs://ybbi/bi_landing_zone/files_to_load/apn/reports/appnexus_network_analytics_report/20140901191111_3bab8ec0_092a_43de_a157_db35d1555ea0/*
and
gs://ybbi/bi_landing_zone/files_to_load/apn/reports/appnexus_network_analytics_report/20140901191111_some_other_path/*

Bug in NSFileManager (instance method is traversing symbolic link)

I am using copyItemAtPath:toPath:error: for copy operation. From documentation:
Symbolic links are not traversed but are themselves copied
but this method is traversing symbolic link and copying orignal content for Symbolic links created by ln -s(in 10.5).
kMDItemFSFinderFlags is zero for alias created by ln -s.
attributesOfItemAtPath:error: returns NSFileType = NSFileTypeSymbolicLink
From What's the difference between alias and link?
An alias contains two pieces of information: a unique identifier of
the file it links to, and the path and file name of the file it links
to.
If you rename or move a file, and then create a new file with the path
and file name that the file originally had, then any alias that linked
to the original file now links to the new file.
However, if you rename or move a file without replacing it, and then
invoke an alias, the alias is updated to point to the new path and
file name, making use of the unique identifier to do so.
A symbolic link, on the other hand, does not contain a unique
identifier to a file, and would appear as broken if the file is
renamed or moved and not replaced with a file of the same path and
file name.
when i am creating alias using
tell application "Finder"
make new alias at POSIX file "/Users/test/" to POSIX file "/Applications/Safari.app"
end tell
copyItemAtPath:toPath:error: is working fine and kMDItemFSFinderFlags = 33792.
attributesOfItemAtPath:error: returns NSFileType = NSFileTypeRegular;
Can anyone please help me out?
If this indeed a bug try using copyfile() (C function, man section 3) instead.