I am trying to get the files in zip format which were newly created around two days ago using powershell and I am not getting any output

Gtu
$Servers = Get-content 'D:\utils\Backup\SBX servers.txt'

foreach($Path in $Servers){
  $Path = "E:\Backup" 
  $result = Get-ChildItem E:\Backup\*_DB.zip -Recurse -Force -File |Format-Wide| Where-Object { $_.LastWriteTime -gt (get-date).AddDays(-1)}
  $result
}
LxLechat

you were not far from the solution, but there are multiple problem with your syntax. First you should not "filter" (where-object), after "formating" (Format-wide).

foreach($Path in $Servers){
    $Path = "E:\Backup"
    $result = Get-ChildItem E:\Backup*DB.zip -Recurse -Force -File | Where-Object { $_.LastWriteTime -gt (get-date).AddDays(-1)}
    $result | Format-Wide
}

you were missing the "underscore" in your filter too: "$." -> "$_."

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I am not getting any output using structures

How to implement this i am not getting any output

Why am I not getting any output? And there is an InputMismatchException

I am not getting any output for this python code

I am trying to send multiple title and multiple files into database using laravel but i am getting error

Why am I getting a newly created Mutex if I am reusing an existing one in the following code?

I am getting error when I am trying to get video links of YouTube playlist using Paffy

I am trying to get rid of rows using multiple values, but I am getting an error

I am unable to get any sort of output

I am trying to figure out why I am getting the two error messages that I am, and how to fix them. I am using python

I am getting this weird ERROR while executing my code it was working normally 3 days ago

I am trying to add files to google drive using kotlin in cororutines but getting error that main thread will be blocked even if i am using coroutine

I am trying to write a new file and return the file size and the output should be 31 in this example but i am getting 0 .(using python)

Why am I getting shift around header regions in two HTML pages built using almost same code

I am trying to download multiple image as a zip file but getting error using laravel 7

Error when i am trying to create a zip from 2 files

Why is there no output getting displayed? Here I am trying to display two strings in alternate positions

Why I am getting this output?

I am not getting output proper

Why am I getting no output?

Why am I getting this output

I am getting weird output

Why am i not getting an output

I am trying to get the cpucapacity/cpuused value from the below json output from Ansible module am getting blank msg or error

I am trying to get retrive data from mongodb but not getting expected output

I just want to swap two numbers using C. But I am not getting the desired output

I am trying to get the output in below nested dictionary format for the given input

I am trying to remove the numbers that are in the names of the files, which are in a list:

i am trying to send request to https://www.google.com and get a responce. I am using asyncTask but getting the following exception