I have to make sure that a specific file exists in a subfolder underneath every user directory in C:\Documents and Settings. For example, the filename is pesky.txt and it has to be in the “C:\Documents and Settings\X\Application Data\Pesky” folder (where X is all the subfolders of the C:\Documents and Settings directory). I need the relevance to tell me if there is a user profile that doesn’t have that file in that specific directory but what I’m coming up with is that I can check if it exists at all somewhere in the directory path or if it doesn’t exist in ANY possible subfolder - not just the one I need to check in.
This relevance evaluates to true even on user profiles that have the subdirectory because it iterates through every possible subdirectory and some of those don’t have the path.
exists folders whose (not exist file “Application Data\pesky\pesky.txt”) of folders of folder “C:\Documents and Settings”
This relevance evaluates to false if there is even one user that has the pesky folder even though there are other users that don’t.
not exists folders “Application Data\pesky” of folders of folder “C:\Documents and Settings”
How can I get the relevance to evaluate to true when there is at least one folder underneath “C:\Documents and Settings” that doesn’t have a “Application Data\pesky\pesky.txt” file inside of it?
YES! That totally gets the relevance correct! Thank you very much.
So now I’m trying to get the action language to copy the file to the folders that would be output from that relevance. I am not having much luck.
I was thinking about trying to get the relevance in the action to write a batch file for me that would have the path names that needed the file but it’s not going so well. Here’s the mess I have right now (just the relevance part that would be output to a batch file).
"copy __Download\pesky.txt " & concatenation “%0d%0a” of (pathnames of folders “Application Data” whose (not exist file “pesky\pesky.txt” of it) of folders of folder “c:\documents and settings”) & “\pesky” & “%22”
It’s only putting the copy and quotes at the beginning/end. It comes back with an error about it must be a singular expression every time I try and change it up to get it to output something like:
copy __Download\pesky.txt “C:\documents and settings\user1\pesky\pesky.txt”
Try throwing some “it” action in there so you can concatenate to each result returned by the pathname relevance:
concatenation of (“copy __Download\pesky.txt %22” & it & “\pesky\pesky.txt%22%0d%0a”) of (pathnames of folders “Application Data” whose (not exist file “pesky\pesky.txt” of it) of folders of folder “c:\documents and settings”)
You might also want to filter out some of the system user folders like All Users and LocalService with the following:
concatenation of (“copy __Download\pesky.txt %22” & it & “\pesky\pesky.txt%22%0d%0a”) of (pathnames of folders “Application Data” whose (not exist file “pesky\pesky.txt” of it) of folders whose ("|All Users|Default User|LocalService|NetworkService|" does not contain ("|" & name of it & “|”)) of folder “c:\documents and settings”)