About Directory Contents in asp.net - c#-4.0

I have a directory and I want to save a image in that directory.
How would I know an image already exists in that directory or not?

You can determine if the file exists (by name) using the File.Exists method. There is, however, the possibility of a file being saved with the same name between the time of checking and saving your own.
In a web application I often used mapped GUID values as file names.
Anyway, I think this is what you're asking, though it isn't greatly conveyed as to your exact current predicament.

Related

Revit API - Finding the path of nested links

I am trying to find the file path of nested links and ran into a problem.
I am interested in the 2nd level, meaning finding the file path of a link inside one of the links in the file that I currently have opened.
My problem is where the reference Type is Overlay, if reference type is Attachment I don't have a problem.
I am also assuming the files are in BIM360 cloud, but I believe I have the same problem if the files were local.
I am able to get the RevitLinkInstance and RevitLinkType object for those links.
However, if I try to use GetLinkDocument() on the RevitLinkInstance I get null, and trying getting the InSessionPath using GetExternalResourceReferences() on the RevitLinkType get me "Autodesk Docs://" and stops there without the real path.
Will appreciate any help including letting me know if this is at all possible.
Thank you,
To my knowlegde it is impossible to get the link within a link through one Document. This is because with Overlay the link is not stored into the Link. That is also why it works with Attachment. Because Revit than makes it a point to store the Link in that file and thus it is part of that Revit file.
What you could do instead is search for the file path of the first link. Then use the file path in the OpenAndActivateDocument(string filepath) method. Repeat the first step to get all RevitLinkInstances of this Document. You can get the needed information from this link, store it in a variable and close the link document.
If an example is needed please let me know.

Check share point if file exists in a shared document folder with power automate

I am trying to get the attachments of some emails and check if that attachment already exists in SharePoint. However, since the flow may have already run over some attachments that have already been received, they may or may not already be in SharePoint, so I first have to check SharePoint if the attachment exists and if they don't, create the file using the email attachment content.
So what I have so far is replicating a process that was described here
The problem that quickly arises is that under "Get file content using path" action, the File Path input box(circled below) won't let me append a file path that isn't currently already in a document folder.
Not sure if this is still a valid way to accomplish it or if there's another way. I have checked all over the place and still haven't been able to find a solution. If there's anybody that can help it would be greatly appreciated!!
To tackle this what you can do is to create a variable using Initialize variable action and compose the path e.g. '/DocumentLibrary/file.ext' that you want to check if exists. then you can refer to that variable in your folder path box for Get file content using path action. Please see the screenshot:
Next you can configure run afterfor file creation action and create file if Get file content using path action has failed, otherwise do other stuff that is required. I have tested this for sending different emails based upon file found or not found and it works well.
Hope this solves your issue.

Is there a solution to choose how my file is renamed if a file with the same name already exist?

In SharePoint online when my flow moves the file (PDF, ZIP...) named "U000" in a folder where is a file with the same name it renames the file in "U0001".
How can I customize this to be renamed like "U000-Rev.1" or "U000_copy(1)" instead of "U0001"?
I know this is the default SharePoint behavior and there is no option for renaming format but maybe I can change or add a code in "definition.json" file from exported ZIP flow (or somewhere else).
(I'm not a software developer so any answer/idea is welcomed.)
Thank you!
Add an if statement to check the file name you just uploaded. If it contains (1) at the end of the name then rename the file. This is probably the least convoluted fast approach but it's not 100% robust.
You can add more logic or change the approach to make it fully robust but you can look into that after you've got something working imo, baby steps.

Delete folder by name from google drive using gdrive

I have read the documentation for gdrive here, but I couldn't find a way to do what I want to do. I want to write a bash script to upload automatically a specific folder from my hard drive. The problem is that when I upload it several times, instead of replacing the old folder by the new one, it generates a new folder with the same name.
I could only find the following partial solutions to my problem:
Use update to replace files. The problem with this partial solution is that new files inside the folder could not get uploaded automatically, and I would have to change the bash script every time a new file is produced in the folder that I want to upload.
Erase the folder by its id from google drive and then upload the folder again. The problem here is that whenever I do this, the id of the uploaded folder chagnes, so I couldn't find a way to write a script to do the work.
I am looking for any method that solves my problem. But the precise questions that could help me are:
Is there a way to delete a folder from google drive (using gdrive) by its name instead of by its id?
Is there a way to get the id of a folder by its name? I guess not, since there can be several folders with the same name (but different ids) uploaded. Or am I missing something?
Is there a way to do a recursive update to renew all files that are already inside the folder uploaded on google drive and in addition upload those that are not yet uploaded?
In case it is relevant, I am using Linux Mint 18.1.
Is there a way to delete a folder from google drive (using gdrive) by its name instead of by its id?
Nope. As your next question observes, there can be multiple such folders.
Is there a way to get the id of a folder by its name? I guess not, since there can be several folders with the same name (but different ids) uploaded. Or am I missing something?
You can get the ids (plural) of all folders with a given name.
gdrive list -q "name = 'My folder name' and mimeType='application/vnd.google-apps.folder' and trashed=false"
Is there a way to do a recursive update to renew all files that are already inside the folder uploaded on google drive and in addition upload those that are not yet uploaded?
Yes, but obviously not with a single command. You'll need to write a short script using gdrive list and parse (awk works well) the output.

How to add User Specific information in Exe File

I have a code on the server-side(application) that links with the client-side(application).
The user signs-up to download the exe(client-side application).
There must be a unique way to identify the user(client app exe) with the info got from sign-up.
So, one of the information must be attached to exe file during the download.
One of the ways I found is using "Portable Executable".
Is it possible to add string data to exe and later retrieve it?
Is there any other possible way to make the exe user-specific? Or is it possible to add the user information along with the downloaded exe?
Yes, it is potentially possible to modify the exe at runtime to put your own stream. You might put the User Specific information in an existing Resource prepared for this "update". This would be the easiest way to avoid to take care about changing other parameter like size, etc.. Another option would be to put the User Specific information in the overlay of the Exe.

Resources